W3cubDocs

/TensorFlow C++ 2.9

tensorflow::ops::Multinomial

#include <random_ops.h>

Draws samples from a multinomial distribution.

Summary

Args:

  • scope: A Scope object
  • 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.

Optional attributes (see Attrs):

  • seed: If either seed or seed2 is set to be non-zero, the internal random number generator is seeded by the given seed. Otherwise, a random seed is used.
  • seed2: A second seed to avoid seed collision.

Returns:

  • Output: 2-D Tensor with shape [batch_size, num_samples]. Each slice [i, :] contains the drawn class labels with range [0, num_classes).
Constructors and Destructors
Multinomial(const ::tensorflow::Scope & scope, ::tensorflow::Input logits, ::tensorflow::Input num_samples)
Multinomial(const ::tensorflow::Scope & scope, ::tensorflow::Input logits, ::tensorflow::Input num_samples, const Multinomial::Attrs & attrs)
Public attributes
operation
output
Public functions
node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const
Public static functions
OutputDtype(DataType x)
Seed(int64 x)
Seed2(int64 x)
Structs
tensorflow::ops::Multinomial::Attrs

Optional attribute setters for Multinomial.

Public attributes

operation

Operation operation

output

::tensorflow::Output output

Public functions

Multinomial

 Multinomial(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input logits,
  ::tensorflow::Input num_samples
)

Multinomial

 Multinomial(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input logits,
  ::tensorflow::Input num_samples,
  const Multinomial::Attrs & attrs
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

operator::tensorflow::Input() const 

operator::tensorflow::Output

operator::tensorflow::Output() const 

Public static functions

OutputDtype

Attrs OutputDtype(
  DataType x
)

Seed

Attrs Seed(
  int64 x
)

Seed2

Attrs Seed2(
  int64 x
)

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/cc/class/tensorflow/ops/multinomial