paddle. standard_gamma ( x, name=None ) [source]

Returns a tensor filled with random number from a Standard Gamma Distribution.

\[out_i \sim Gamma (alpha = x_i, beta = 1.0)\]
  • x (Tensor) – A tensor with rate parameter of standard gamma Distribution. The data type should be bfloat16, float16, float32, float64.

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.


A Tensor filled with random number with the same shape and dtype as x.

Return type



>>> import paddle
>>> paddle.set_device('cpu')
>>> paddle.seed(100)

>>> x = paddle.uniform([2,3], min=1.0, max=5.0)
>>> out = paddle.standard_gamma(x)
>>> print(out)
Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
[[3.35393834, 0.80538225, 0.36511323],
 [6.10344696, 4.28612375, 6.37196636]])