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

Function Argmax

tests/bin/test_mobilenet.cpp:67–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static inline std::vector<int> Argmax(const std::vector<float>& v, int N)
68{
69 std::vector<std::pair<float, int>> pairs;
70 for(size_t i = 0; i < v.size(); ++i)
71 pairs.push_back(std::make_pair(v[i], i));
72 std::partial_sort(pairs.begin(), pairs.begin() + N, pairs.end(), PairCompare);
73
74 std::vector<int> result;
75 for(int i = 0; i < N; ++i)
76 result.push_back(pairs[i].second);
77 return result;
78}
79
80void get_input_data(const char* image_file, float* input_data, int img_h, int img_w, const float* mean, float scale)
81{

Callers 1

mainFunction · 0.70

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected