W3cubDocs

/TensorFlow 2.4

tf.compat.v1.multinomial

Draws samples from a multinomial distribution. (deprecated)

Example:

# samples has shape [1, 5], where each value is either 0 or 1 with equal
# probability.
samples = tf.random.categorical(tf.math.log([[0.5, 0.5]]), 5)
Args
logits 2-D Tensor with shape [batch_size, num_classes]. Each slice [i, :] represents the unnormalized log-probabilities for all classes.
num_samples 0-D. Number of independent samples to draw for each row slice.
seed A Python integer. Used to create a random seed for the distribution. See tf.random.set_seed for behavior.
name Optional name for the operation.
output_dtype integer type to use for the output. Defaults to int64.
Returns
The drawn samples of shape [batch_size, num_samples].

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/compat/v1/multinomial