tf.multinomial

tf.multinomial

tf.multinomial

multinomial(
    logits,
    num_samples,
    seed=None,
    name=None
)

Defined in tensorflow/python/ops/random_ops.py.

See the guide: Constants, Sequences, and Random Values > Random Tensors

Draws samples from a multinomial distribution.

Example:

# samples has shape [1, 5], where each value is either 0 or 1 with equal
# probability.
samples = tf.multinomial(tf.log([[10., 10.]]), 5)

Args:

  • logits: 2-D Tensor with shape [batch_size, num_classes]. Each slice [i, :] represents the log-odds 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.set_random_seed for behavior.
  • name: Optional name for the operation.

Returns:

The drawn samples of shape [batch_size, num_samples].

© 2017 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/api_docs/python/tf/multinomial

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部