mindspore.ops.Poisson
- class mindspore.ops.Poisson(seed=0, seed2=0)[源代码]
Produces random non-negative integer values i, distributed according to discrete probability function:
\[\text{P}(i|μ) = \frac{\exp(-μ)μ^{i}}{i!},\]- Parameters
- Inputs:
shape (tuple) - The shape of random tensor to be generated. Only constant value is allowed.
mean (Tensor) - μ parameter the distribution was constructed with. The parameter defines mean number of occurrences of the event. It must be greater than 0. With float32 data type.
- Outputs:
Tensor. Its shape must be the broadcasted shape of shape and the shape of mean. The dtype is int32.
- Raises
- Supported Platforms:
Ascend
Examples
>>> shape = (4, 1) >>> mean = Tensor(np.array([5.0, 10.0]), mstype.float32) >>> poisson = ops.Poisson(seed=5) >>> output = poisson(shape, mean) >>> result = output.shape >>> print(result) (4, 2)