2.3K Star 8.1K Fork 4.3K

GVPMindSpore / mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindspore.ops.func_randint_like.rst 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
wind-zyx 提交于 2023-04-21 16:49 . ops update value format 0421

mindspore.ops.randint_like

.. py:function:: mindspore.ops.randint_like(input, low, high, *, dtype=None, seed=None)

    返回一个Tensor,其元素为 [ `low` , `high` ) 区间的随机整数,根据 `input` 决定shape和dtype。

    参数:
        - **input** (Tensor) - 输入的Tensor,用来决定输出Tensor的shape和默认的dtype。
        - **low** (int) - 随机区间的起始值。
        - **high** (int) - 随机区间的结束值。
        - **seed** (int,可选) - 随机种子,必须大于或等于0。默认值: ``None`` ,值将取 ``0`` 。

    关键字参数:
        - **dtype** (:class:`mindspore.dtype`,可选) - 指定的Tensor dtype,必须是int类型的dtype。如果是 ``None`` ,将会使用 `input` 的dtype。默认值: ``None`` 。

    返回:
        Tensor,shape和dtype被输入指定,其元素为 [ `low` , `high` ) 区间的随机整数。

    异常:
        - **TypeError** - 如果 `seed` 不是非负整数。
        - **TypeError** - 如果 `low` 或 `high` 不是整数。
        - **ValueError** - 如果 `dtype` 不是 `mstype.int_type` 类型。
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
master

搜索帮助