You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.UniformReal.rst 1.1 kB

1234567891011121314151617181920212223242526272829303132333435363738
  1. mindspore.ops.UniformReal
  2. =========================
  3. .. py:class:: mindspore.ops.UniformReal(seed=0, seed2=0)
  4. 产生随机的浮点数i,均匀分布在[0,1)范围内。
  5. **参数:**
  6. - **seed** (int) - 算子层的随机种子,用于生成随机数。必须是非负的。默认值:0。
  7. - **seed2** (int):全局的随机种子,和算子层的随机种子共同决定最终生成的随机数。必须是非负的。默认值:0。
  8. **输入:**
  9. - **shape** (tuple) - 待生成的随机Tensor的shape。只支持常量值。
  10. **输出:**
  11. Tensor。它的shape为输入 `shape` 表示的值。数据类型为float32。
  12. **异常:**
  13. - **TypeError** - `seed` 和 `seed2` 都不是int。
  14. - **TypeError** - `shape` 不是tuple。
  15. - **ValueError** - `shape` 不是常量值。
  16. **支持平台:**
  17. ``Ascend`` ``GPU`` ``CPU``
  18. **样例:**
  19. >>> shape = (2, 2)
  20. >>> uniformreal = ops.UniformReal(seed=2)
  21. >>> output = uniformreal(shape)
  22. >>> result = output.shape
  23. >>> print(result)
  24. (2, 2)