MCPcopy Create free account
hub / github.com/Tencent/embedx / SampleNode

Function SampleNode

src/tools/graph/average_feature_main.cc:30–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace {
29
30void SampleNode(int count, const vec_pair_t& context, vec_int_t* nodes) {
31 nodes->clear();
32
33 if (context.size() <= (size_t)count) {
34 for (auto& entry : context) {
35 nodes->emplace_back(entry.first);
36 }
37 } else {
38 for (int i = 0; i < count; ++i) {
39 auto k = int(ThreadLocalRandom() * context.size());
40 nodes->emplace_back(context[k].first);
41 }
42 }
43}
44
45void AverageFeature(const std::vector<vec_pair_t>& feats_list,
46 vec_pair_t* average_feats) {

Callers 1

AverageBatchFeatureMethod · 0.85

Calls 2

ThreadLocalRandomFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected