mindspore.ops.multinomial_with_replacement
- mindspore.ops.multinomial_with_replacement(x, seed, offset, numsamples, replacement=False)[source]
Generate a tensor from a multinomial distribution.
Warning
This interface is deprecated and will be removed after version 2.9.0.
Note
The rows of input do not need to sum to one (in which case we use the values as weights), but must be non-negative, finite and have a non-zero sum.
If seed is set to be
-1, and offset is set to be0, the random number generator is seeded by a random seed.
- Parameters
- Returns
Tensor
- Supported Platforms:
CPU
Examples
>>> import mindspore >>> x = mindspore.tensor([[0., 9., 4., 0.]], mindspore.float32) >>> mindspore.ops.multinomial_with_replacement(x, 2, 5, 2, True) Tensor(shape=[1, 2], dtype=Int64, value= [[1, 1]])