mindspore/docs/api/api_python/ops/mindspore.ops.NonDeterminis...

32 lines
1.3 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.NonDeterministicInts
===================================
.. py:class:: mindspore.ops.NonDeterministicInts(dtype=mstype.int64)
`ops.NonDeterministicInts` 从2.8.0版本开始已被弃用,并将在未来版本中被移除。
建议使用 :func:`mindspore.ops.randint_like` 替代。
生成指定数据类型范围内的随机整数。
返回Tensor的shape由输入 `shape` 指定,其中的随机数从指定数据类型的可表示范围内抽取。
.. warning::
`shape` 中的值必须大于零输出元素总数不可超过1000000。
参数:
- **dtype** (mindspore.dtype可选) - 输出数据类型。支持的数据类型为: ``mstype.int32````mstype.int64`` 。默认值: ``mstype.int64``
输入:
- **shape** (Tensor) - 输出Tensor的shape。支持的数据类型为int32和int64。
输出:
Tensor其shape由输入 `shape` 指定,数据类型由参数 `dtype` 指定。
异常:
- **TypeError** - `shape` 不是Tensor。
- **TypeError** - `dtype` 不是mstype.int32或mstype.int64。
- **ValueError** - `shape` 中含有负数。
- **ValueError** - `shape` 元素个数少于2。
- **ValueError** - `shape` 不是一维Tensor。
- **ValueError** - 输出元素总个数大于1000000。