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

Function Argmax

examples/tengine_model/classification/classification_fp16.cpp:106–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

PrintTopLabelsFunction · 0.70

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected