mindspore/docs/api/api_python/ops/mindspore.ops.StandardLapla...

28 lines
1.2 KiB
ReStructuredText
Raw Normal View History

mindspore.ops.StandardLaplace
=============================
.. py:class:: mindspore.ops.StandardLaplace(seed=0, seed2=0)
生成符合标准Laplacemean=0, lambda=1分布的随机数。
其概率密度函数为:
.. math::
\text{f}(x) = \frac{1}{2}\exp(-|x|)
2022-07-22 11:20:32 +08:00
参数:
- **seed** (int) - 算子层的随机种子用于生成随机数。必须是非负的。默认值0。
- **seed2** (int) - 全局的随机种子和算子层的随机种子共同决定最终生成的随机数。必须是非负的。默认值0。
输入:
- **shape** (Union[tuple, Tensor]) - 待生成的Tensor的shape。当为tuple类型时只支持常量值当为Tensor类型时支持动态Shape。
输出:
Tensor。shape为输入 `shape` 。数据类型支持float32。
异常:
- **TypeError** - `seed``seed2` 不是int。
- **TypeError** - `shape` 既不是tuple也不是Tensor。
- **ValueError** - `seed``seed2` 不是非负的int。
- **ValueError** - `shape` 为tuple时包含非正的元素。
2022-11-02 11:35:04 +08:00
- **ValueError** - `shape` 为秩不等于1的Tensor。