2022-11-11 15:39:59 +08:00
|
|
|
|
mindspore.ops.NonDeterministicInts
|
|
|
|
|
|
===================================
|
|
|
|
|
|
|
2022-11-24 18:23:29 +08:00
|
|
|
|
.. py:class:: mindspore.ops.NonDeterministicInts(dtype=mstype.int64)
|
2022-11-11 15:39:59 +08:00
|
|
|
|
|
|
|
|
|
|
生成指定数据类型范围内的随机整数。
|
|
|
|
|
|
|
|
|
|
|
|
返回Tensor的shape由输入 `shape` 指定,其中的随机数从指定数据类型的可表示范围内抽取。
|
|
|
|
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
`shape` 中的值必须大于零,输出元素总数不可超过1000000。
|
|
|
|
|
|
|
|
|
|
|
|
参数:
|
2022-11-24 18:23:29 +08:00
|
|
|
|
- **dtype** (mindspore.dtype,可选) - 输出数据类型。支持的数据类型为:mstype.int32和mstype.int64。默认值:mstype.int64。
|
2022-11-11 15:39:59 +08:00
|
|
|
|
|
|
|
|
|
|
输入:
|
|
|
|
|
|
- **shape** (Tensor) - 输出Tensor的shape。支持的数据类型为:int32和int64。
|
|
|
|
|
|
|
|
|
|
|
|
输出:
|
|
|
|
|
|
Tensor,其shape由输入 `shape` 指定,数据类型由参数 `dtype` 指定。
|
|
|
|
|
|
|
|
|
|
|
|
异常:
|
|
|
|
|
|
- **TypeError** - `shape` 不是Tensor。
|
2022-11-24 18:23:29 +08:00
|
|
|
|
- **TypeError** - `dtype` 不是mstype.int32或mstype.int64。
|
2022-11-11 15:39:59 +08:00
|
|
|
|
- **ValueError** - `shape` 中含有负数。
|
|
|
|
|
|
- **ValueError** - `shape` 元素个数少于2。
|
|
|
|
|
|
- **ValueError** - `shape` 不是一维Tensor。
|
|
|
|
|
|
- **ValueError** - 输出元素总个数大于1000000。
|