Multinomial - version 7#

This page documents version 7 of operator Multinomial. See Multinomial for the latest version (since version 22).

  • Domain: ai.onnx

  • Since version: 7

Generate a tensor of samples from a multinomial distribution according to the probabilities of each of the possible outcomes.

Inputs

  • input (T1): Input tensor with shape [batch_size, class_size], where class_size is the number of all possible outcomes. Each value along the axis zero represents the unnormalized log-probability of each corresponding outcome in a batch.

Outputs

  • output (T2): Output tensor with shape [batch_size, sample_size], where sample_size is the number of times to sample. Each value along the axis zero represents the outcome of the corresponding sample in a batch.

Attributes

  • dtype (int): (Optional) The data type for the elements of the output tensor, if not specified, we will use int32.

  • sample_size (int): Number of times to sample.

  • seed (float): (Optional) Seed to the random generator, if not specified we will auto generate one.

Type Constraints

  • T1: Constrain input types to float tensors. Allowed types: tensor(double), tensor(float), tensor(float16).

  • T2: Constrain output types to integral tensors. Allowed types: tensor(int32), tensor(int64).