mindspore.ops.random_gamma
- mindspore.ops.random_gamma(shape, alpha, seed=0, seed2=0)[source]
Outputs random values from the Gamma distribution(s) described by alpha.
- Parameters
shape (Tensor) – The shape of random tensor to be generated. Must be one of the following types: int32, int64. 1-D integer tensor.
alpha (Tensor) – The alpha α distribution parameter. A Tensor. Must be one of the following types: half, float32, float64.
seed (int) – Seed is used as entropy source for the random number engines to generate pseudo-random numbers, must be non-negative. Default: None, which will be treated as 0.
seed2 (int) – Seed2 is used as entropy source for the random number engines to generate pseudo-random numbers, must be non-negative. Default: None, which will be treated as 0.
- Returns
Tensor. The shape should be equal to the concat shape between the input shape and the broadcast of alpha. The dtype is the same type as alpha.
- Raises
- Supported Platforms:
CPU
Examples
>>> import numpy as np >>> from mindspore.ops import functional as F >>> shape = Tensor(np.array([7, 5]), mindspore.int32) >>> alpha = Tensor(np.array([0.5, 1.5]), mindspore.float32) >>> output = F.random_gamma(shape, alpha, seed=5) >>> result = output.shape >>> print(result) (7, 5, 2)