|TensorFlow 1 version||View source on GitHub|
Samples a set of classes using the provided (fixed) base distribution.
See Migration guide for more details.
tf.random.fixed_unigram_candidate_sampler( true_classes, num_true, num_sampled, unique, range_max, vocab_file='', distortion=1.0, num_reserved_ids=0, num_shards=1, shard=0, unigrams=(), 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 is read from a file or passed in as an in-memory array. There is also an option to skew the distribution by applying a distortion power to the weights.
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
defined in this
unique=True, then these are post-rejection probabilities and we
compute them approximately.