ivy.multinomial(probs, num_samples, f=None)[source]

Draws samples from a multinomial distribution. Specifcally, returns a tensor where each row contains num_samples indices sampled from the multinomial probability distribution located in the corresponding row of tensor input.

  • probs (array) – The unnormalized probabilities for all classes [batch_shape, num_classes]

  • num_samples (int) – Number of independent samples to draw for each row slice

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.


Drawn samples from the multinomial distribution.

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty