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

Method Pick

tensorflow/core/lib/random/weighted_picker.cc:100–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100int WeightedPicker::Pick(SimplePhilox* rnd) const {
101 if (total_weight() == 0) return -1;
102
103 // using unbiased uniform distribution to avoid bias
104 // toward low elements resulting from a possible use
105 // of big weights.
106 return PickAt(UnbiasedUniform(rnd, total_weight()));
107}
108
109int WeightedPicker::PickAt(int32 weight_index) const {
110 if (weight_index < 0 || weight_index >= total_weight()) return -1;

Callers 6

TESTFunction · 0.80
TestPickerFunction · 0.80
CheckUniformFunction · 0.80
CheckSkewedFunction · 0.80
BM_PickFunction · 0.80
SampleMethod · 0.80

Calls 1

UnbiasedUniformFunction · 0.85

Tested by 5

TESTFunction · 0.64
TestPickerFunction · 0.64
CheckUniformFunction · 0.64
CheckSkewedFunction · 0.64
BM_PickFunction · 0.64