mindspore.ops.standard_laplace

View Source On Gitee
mindspore.ops.standard_laplace(shape, seed=None)[source]

Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1).

f(x)=12exp(|x|)

Warning

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

Parameters
  • shape (Union[tuple, Tensor]) – The shape of returned tensor.

  • seed (int, optional) – Random number seed. Default None .

Returns

Tensor

Raises
  • ValueError – If shape is a tuple containing non-positive items.

  • ValueError – If shape is a Tensor, and the rank of the Tensor is not equal to 1.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> shape = (4, 4)
>>> output = mindspore.ops.standard_laplace(shape, seed=5)
>>> print(f'output shape is {output.shape}')
output shape is (4, 4)