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

Function Argmax

internal/bin/classification.cpp:45–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static inline std::vector<int> Argmax(const std::vector<float>& v, const int N)
46{
47 std::vector<std::pair<float, int>> pairs;
48 for(size_t i = 0; i < v.size(); ++i)
49 pairs.push_back(std::make_pair(v[i], i));
50 std::partial_sort(pairs.begin(), pairs.begin() + N, pairs.end(), PairCompare);
51
52 std::vector<int> result;
53 for(int i = 0; i < N; ++i)
54 result.push_back(pairs[i].second);
55 return result;
56}
57
58void get_input_data(const char* image_file, float* input_data, const int img_h, const int img_w, const float* mean,
59 const float scale)

Callers 2

PrintTopLabelsFunction · 0.70
PrintTopLabels_uint8Function · 0.70

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected