MCPcopy Create free account
hub / github.com/OAID/Tengine / Argmax

Function Argmax

examples/tengine_model/classification/classification_tf.cpp:102–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static inline std::vector<int> Argmax(const std::vector<float>& v, int N)
103{
104 std::vector<std::pair<float, int>> pairs;
105 for(size_t i = 0; i < v.size(); ++i)
106 pairs.push_back(std::make_pair(v[i], i));
107 std::partial_sort(pairs.begin(), pairs.begin() + N, pairs.end(), PairCompare);
108
109 std::vector<int> result;
110 for(int i = 0; i < N; ++i)
111 result.push_back(pairs[i].second);
112 return result;
113}
114
115void get_input_data(const char* image_file, float* input_data, const int img_h, const int img_w, const float mean,
116 const float scale)

Callers 1

PrintTopLabelsFunction · 0.70

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected