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

Method SetWeightsFromArray

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

Source from the content-addressed store, hash-verified

153}
154
155void WeightedPicker::SetWeightsFromArray(int N, const int32* weights) {
156 Resize(N);
157
158 // Initialize leaves
159 int32* leaves = level_[num_levels_ - 1];
160 for (int i = 0; i < N_; i++) leaves[i] = weights[i];
161 for (int i = N_; i < LevelSize(num_levels_ - 1); i++) leaves[i] = 0;
162
163 // Now sum up towards the root
164 RebuildTreeWeights();
165}
166
167void WeightedPicker::RebuildTreeWeights() {
168 for (int l = num_levels_ - 2; l >= 0; l--) {

Callers 3

TestPickerFunction · 0.80
TestPickAtFunction · 0.80
BM_CreateAndSetWeightsFunction · 0.80

Calls 1

ResizeFunction · 0.50

Tested by 3

TestPickerFunction · 0.64
TestPickAtFunction · 0.64
BM_CreateAndSetWeightsFunction · 0.64