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

Method LoadFromUnigrams

tensorflow/core/kernels/range_sampler.cc:313–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void FixedUnigramSampler::LoadFromUnigrams(const std::vector<float>& unigrams,
314 float distortion) {
315 int32 word_id = weights_.size();
316 for (float w : unigrams) {
317 // Skip entries that do not belong to this shard.
318 if (word_id % num_shards_ == shard_) {
319 w = std::pow(w, distortion);
320 total_weight_ += w;
321 weights_.push_back(w);
322 }
323 ++word_id;
324 }
325}
326
327} // namespace tensorflow

Callers

nothing calls this directly

Calls 3

powClass · 0.70
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected