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

Function PostInitServerDistribution

src/graph/client/resource_post_initializer.cc:88–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool PostInitServerDistribution(int shard_num,
89 graph_op::DistGSOpResource* resource) {
90 int ns_size = 0;
91 vec_float_t probs;
92 if (!FetchServerDistribution(shard_num, &ns_size, &probs)) {
93 return false;
94 }
95 if (ns_size <= 0) {
96 DXINFO("Number of namespace size: %d must be greater than 0.", ns_size);
97 return false;
98 }
99 DXINFO("Number of namespace size is: %d.", ns_size);
100 resource->set_ns_size(ns_size);
101
102 auto sampling = NewSampling(&probs, SamplingEnum::ALIAS);
103 if (!sampling) {
104 return false;
105 }
106 resource->set_sampling(std::move(sampling));
107
108 return true;
109}
110} // namespace embedx

Callers 1

InitMethod · 0.85

Calls 4

FetchServerDistributionFunction · 0.85
NewSamplingFunction · 0.85
set_ns_sizeMethod · 0.80
set_samplingMethod · 0.80

Tested by

no test coverage detected