mindspore.ops.poisson
- mindspore.ops.poisson(shape, mean, seed=None)[source]
Generates random numbers according to the Poisson random number distribution.
\[\text{P}(i|μ) = \frac{\exp(-μ)μ^{i}}{i!}\]- Parameters
shape (tuple) – The shape of random tensor to be generated.
mean (Tensor) – The mean μ distribution parameter. It should be greater than 0 with float32 data type.
seed (int) – Seed is used as entropy source for the random number engines to generate pseudo-random numbers and must be non-negative. Default: None, which will be treated as 0.
- Returns
Tensor. The shape should be equal to the broadcasted shape between the input “shape” and shapes of mean. The dtype is float32.
- Raises
- Supported Platforms:
Ascend
Examples
>>> import numpy as np >>> from mindspore import Tensor >>> import mindspore.ops.composite as C >>> from mindspore.common import dtype as mstype >>> shape = (4, 1) >>> mean = Tensor(np.array([5.0, 10.0]), mstype.float32) >>> output = C.poisson(shape, mean, seed=5) >>> result = output.shape >>> print(result) (4, 2)