multinomial

ivy.multinomial(population_size, num_samples, batch_size, probs=None, replace=True, dev_str='cpu', 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.

Parameters
  • population_size (int) – The size of the population from which to draw samples.

  • num_samples (int) – Number of independent samples to draw from the population.

  • batch_size – Number of times to draw a new set of samples from the population.

  • probs (array, optional) – The unnormalized probabilities for all elemtns in population, default is uniform [batch_shape, num_classes]

  • replace (bool, optional) – Whether to replace samples once they’ve been drawn. Default is True.

  • dev_str (str) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.

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

Returns

Drawn samples indices from the multinomial distribution.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty