MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / topk

Function topk

src/backend/oneapi/topk.cpp:48–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47template<typename T>
48void topk(Array<T>& vals, Array<unsigned>& idxs, const Array<T>& in,
49 const int k, const int dim, const af::topkFunction order) {
50 auto values = createEmptyArray<T>(in.dims());
51 auto indices = createEmptyArray<unsigned>(in.dims());
52 sort_index(values, indices, in, dim, order & AF_TOPK_MIN);
53 auto indVec = indexForTopK(k);
54 vals = index<T>(values, indVec.data());
55 idxs = index<unsigned>(indices, indVec.data());
56}
57
58#define INSTANTIATE(T) \
59 template void topk<T>(Array<T>&, Array<unsigned>&, const Array<T>&, \

Callers 1

nearest_neighbour_Function · 0.70

Calls 3

sort_indexFunction · 0.70
indexForTopKFunction · 0.70
dimsMethod · 0.45

Tested by

no test coverage detected