tf.random.stateless_multinomial
Stay organized with collections
Save and categorize content based on your preferences.
Draws deterministic pseudorandom samples from a multinomial distribution. (deprecated)
tf.random.stateless_multinomial(
logits, num_samples, seed, output_dtype=tf.dtypes.int64, name=None
)
This is a stateless version of tf.random.categorical
: if run twice with the
same seeds, it will produce the same pseudorandom numbers. The output is
consistent across multiple runs on the same hardware (and between CPU
and GPU), but may change between versions of TensorFlow or on non-CPU/GPU
hardware.
Example:
# samples has shape [1, 5], where each value is either 0 or 1 with equal
# probability.
samples = tf.random.stateless_categorical(
tf.math.log([[0.5, 0.5]]), 5, seed=[7, 17])
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 shape [2] integer Tensor of seeds to the random number generator.
|
output_dtype
|
integer type to use for the output. Defaults to int64.
|
name
|
Optional name for the operation.
|
Returns |
The drawn samples of shape [batch_size, num_samples] .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]