mindspore2022/docs/api/api_python/ops/mindspore.ops.UniformReal.rst

33 lines
1.5 KiB
ReStructuredText
Raw Permalink 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.UniformReal
=========================
.. py:class:: mindspore.ops.UniformReal(seed=0, seed2=0)
产生随机的浮点数,均匀分布在[01)范围内。
**参数:**
- **seed** (int) - 算子层的随机种子用于生成随机数。必须是非负的。默认值0。
- **seed2** (int)全局的随机种子和算子层的随机种子共同决定最终生成的随机数。必须是非负的。默认值0。
.. note::
- 随机种子:通过一些复杂的数学算法,可以得到一组有规律的随机数,而随机种子就是这个随机数的初始值。随机种子相同,得到的随机数就不会改变。
- 全局的随机种子和算子层的随机种子都没设置:使用默认值当做随机种子。
- 全局的随机种子设置了,算子层的随机种子未设置:随机生成一个种子和全局的随机种子拼接。
- 全局的随机种子未设置,算子层的随机种子设置了:使用默认的全局的随机种子,和算子层的随机种子拼接。
- 全局的随机种子和算子层的随机种子都设置了:全局的随机种子和算子层的随机种子拼接。
**输入:**
- **shape** (tuple) - 待生成的Tensor的shape。只支持常量值。
**输出:**
Tensor。它的shape为输入 `shape`。数据类型为float32。
**异常:**
- **TypeError** - `seed``seed2` 不是int。
- **TypeError** - `shape` 不是tuple。
- **ValueError** - `shape` 不是常量值。