Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.RandomPoisson

class mindspore.ops.RandomPoisson(seed=0, seed2=0, dtype=mstype.int64)[source]

Produces random non-negative values i, distributed according to discrete probability function:

P(i|μ)=exp(μ)μii!

Note

  • Random seed: a set of regular random numbers can be obtained through some complex mathematical algorithms, and the random seed is the initial value of this random number. If the random seed is the same in two separate calls, the random number generated will not change.

  • Global random seed and operator-level random seed are not set or both set to 0: behavior is completely random.

  • Global random seed is set, but operator-level random seed is not set: A global random seed will splice with 0 to generate random number.

  • Global random seed is not set, operator-level random seed is set: 0 splices with the operator-level random seed to generate random number.

  • Both Global random and operator-level random seed are set: the global random seed will splice with the operator-level random seed to generate random number.

Parameters
  • seed (int, optional) – The operator-level random seed, used to generate random numbers, must be non-negative. Default: 0 .

  • seed2 (int, optional) – The global random seed, which combines with the operator-level random seed to determine the final generated random number, must be non-negative. Default: 0 .

  • dtype (mindspore.dtype, optional) – The type of output. Default: mstype.int64 .

Inputs:
  • shape (Tensor) - The shape of random tensor to be generated, 1-D Tensor, whose dtype must be in [int32, int64].

  • rate (Tensor) - μ parameter the distribution was constructed with. The parameter defines mean number of occurrences of the event. Its type must be in [float16, float32, float64, int32, int64].

Outputs:

Tensor. Its shape is (shape,rate.shape). Its type is specified by dtype.

Raises
  • TypeError – If shape is not a Tensor or its dtype is not int32 or int64.

  • TypeError – If dtype is not int32 or int64.

  • ValueError – If shape is not a 1-D tensor.

  • ValueError – If shape elements are negative.

Supported Platforms:

GPU CPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> from mindspore import dtype as mstype
>>> shape = Tensor(np.array([2, 3]), mstype.int32)
>>> rate = Tensor(np.array([2, 2]), mstype.int32)
>>> seed = 0
>>> seed2 = 0
>>> random_poisson = ops.RandomPoisson(seed=seed, seed2=seed2)
>>> output = random_poisson(shape,rate)
>>> print(output.shape)
(2, 3, 2)