MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TestPickAt

Function TestPickAt

tensorflow/core/lib/random/weighted_picker_test.cc:223–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223static void TestPickAt(int items, const int32* weights) {
224 WeightedPicker picker(items);
225 picker.SetWeightsFromArray(items, weights);
226 int weight_index = 0;
227 for (int i = 0; i < items; ++i) {
228 for (int j = 0; j < weights[i]; ++j) {
229 int pick = picker.PickAt(weight_index);
230 EXPECT_EQ(pick, i);
231 ++weight_index;
232 }
233 }
234 EXPECT_EQ(weight_index, picker.total_weight());
235}
236
237static void BM_Create(int iters, int arg) {
238 while (--iters > 0) {

Callers 1

TESTFunction · 0.85

Calls 3

SetWeightsFromArrayMethod · 0.80
PickAtMethod · 0.80
total_weightMethod · 0.80

Tested by

no test coverage detected