-1

May i know how to display the values circled in yellow in the console. i tried

using (var results = Session.Run(outputs))
            {
                var highestIndex = results.First().AsTensor<long>().First();
                Console.WriteLine(highestIndex);

                var values = results.Last().Value;
                Console.WriteLine(values);
            }

The [0] value of the results i extract in highestIndex, I need to extract the [1.] values of the values, inside it is in First(), again in First() and Last() values circled in yellow. I just want to display in console like

1
1.7285347E-05
0.9999827

enter image description here

Tried in stack overflow, no one could help. I am python dev, so no sure of c# coding.

Thanks in advance

hanzgs
  • 1,498
  • 17
  • 44

1 Answers1

2

I found the way

            using (var results = Session.Run(outputs))
            {
                var highestIndex = results.First().AsTensor<long>().First();
                Console.WriteLine(highestIndex);
                var seq = results.Last().AsEnumerable<NamedOnnxValue>();
                var map = seq.First().AsDictionary<Int64, float>();
                var values = map.First().Value;
                Console.WriteLine("Index {0} with Probability {1}", map.First().Key, map.First().Value);
                Console.WriteLine("Index {0} with Probability {1}", map.Last().Key, map.Last().Value);
            } 

hanzgs
  • 1,498
  • 17
  • 44