mindspore/docs/api/api_python/ops/mindspore.ops.func_laplace.rst

21 lines
988 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.laplace
======================
.. py:function:: mindspore.ops.laplace(shape, mean, lambda_param, seed=None)
根据拉普拉斯分布生成随机数。
它的定义为:
.. math::
\text{f}(x;μ,λ) = \frac{1}{2λ}\exp(-\frac{|x-μ|}{λ}),
参数:
- **shape** (tuple) - 指定生成随机Tensor的shape。格式为 :math:`(N,*)` ,其中 :math:`*` 表示任意数量的附加维度。
- **mean** (Tensor) - 均值μ分布参数指定峰值的位置。数据类型为float32。
- **lambda_param** (Tensor) - 用于控制此随机分布方差的参数。拉普拉斯分布的方差等于 `lambda_param` 平方的两倍。数据类型为float32。
- **seed** (int可选) - 随机种子用作生成随机数。默认值None此时使用0作为seed。
返回:
Tensor。输出shape应该是使用输入 `shape``mean``lambda_param` 广播后的shape。数据类型为float32。