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

Function knn_data

test/nearest_neighbour.cpp:383–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383nearest_neighbors_params knn_data(const string testname, const int nquery,
384 const int ntrain, const int nfeat,
385 const int k, const int feat_dim) {
386 array indices, dists;
387 array query, train;
388 if (feat_dim == 0) {
389 query = constant(0, nfeat, nquery);
390 train = range(dim4(nfeat, ntrain), 1);
391 } else {
392 query = constant(0, nquery, nfeat);
393 train = range(dim4(ntrain, nfeat), 0);
394 }
395
396 indices = range(dim4(k, nquery), 0, u32);
397 dists = range(dim4(k, nquery));
398 dists *= dists;
399
400 return nearest_neighbors_params(testname, k, feat_dim, query, train,
401 indices, dists);
402}
403
404vector<nearest_neighbors_params> genNNTests() {
405 return {

Callers 1

genKNNTestsFunction · 0.85

Calls 4

constantFunction · 0.85
rangeFunction · 0.50
dim4Class · 0.50

Tested by

no test coverage detected