mindspore.ops.StandardLaplace

class mindspore.ops.StandardLaplace(seed=0, seed2=0)[源代码]

Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1). It is defined as:

\[\text{f}(x;0,1) = \frac{1}{2}\exp(-|x|),\]
Parameters
  • seed (int) – Random seed. Default: 0.

  • seed2 (int) – Random seed2. Default: 0.

Inputs:
  • shape (tuple) - The shape of random tensor to be generated. Only constant value is allowed.

Outputs:

Tensor. The shape that the input ‘shape’ denotes. The dtype is float32.

Raises
  • TypeError – If neither seed nor seed2 is an int.

  • TypeError – If shape is not a tuple.

  • ValueError – If shape is not a constant value.

Supported Platforms:

Ascend

Examples

>>> shape = (4, 16)
>>> stdlaplace = ops.StandardLaplace(seed=2)
>>> output = stdlaplace(shape)
>>> result = output.shape
>>> print(result)
(4, 16)