mindspore.ops.standard_laplace
- mindspore.ops.standard_laplace(shape, seed=0, seed2=0)[source]
Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1). It is defined as:
\[\text{f}(x) = \frac{1}{2}\exp(-|x|),\]- Parameters
- Returns
Tensor. The shape that the input ‘shape’ denotes. The dtype is float32.
- Raises
TypeError – If seed or seed2 is not an int.
TypeError – If shape is neither a tuple nor a Tensor.
ValueError – If seed or seed2 is not a non-negative int.
ValueError – If shape is a tuple containing non-positive items.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from mindspore import ops >>> shape = (4, 4) >>> output = ops.standard_laplace(shape) >>> result = output.shape >>> print(result) (4, 4)