|TensorFlow 1 version||View source on GitHub|
Samples a set of classes from a distribution learned during training.
See Migration guide for more details.
tf.random.learned_unigram_candidate_sampler( true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None )
This operation randomly samples a tensor of sampled classes
sampled_candidates) from the range of integers
The elements of
sampled_candidates are drawn without replacement
unique=True) or with replacement (if
the base distribution.
The base distribution for this operation is constructed on the fly
during training. It is a unigram distribution over the target
classes seen so far during training. Every integer in
begins with a weight of 1, and is incremented by 1 each time it is
seen as a target class. The base distribution is not saved to checkpoints,
so it is reset when the model is reloaded.
In addition, this operation returns tensors
sampled_expected_count representing the number of times each
of the target classes (
true_classes) and the sampled
sampled_candidates) is expected to occur in an average
tensor of sampled classes. These values correspond to