mindspore/docs/api/api_python/ops/mindspore.ops.func_randperm...

20 lines
854 B
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.randperm
========================
.. py:function:: mindspore.ops.randperm(n, seed=0, offset=0, dtype=mstype.int64)
生成从 0 到 n-1 的整数随机排列。
.. warning::
- 这是一个实验性API后续可能修改或删除。
- Ascend后端不支持随机数重现功能 `seed` 参数不起作用。
参数:
- **n** (Union[Tensor, int]) - 输入上界(不包含)。
- **seed** (int, 可选) - 随机种子。默认 ``0`` 。当seed为-1时offset为0随机数由时间决定。
- **offset** (int, 可选) - 偏移量。生成随机数,优先级高于随机种子。必须是非负数,默认 ``0``
- **dtype** (mindspore.dtype, 可选) - 指定数据类型。默认 ``mstype.int64``
返回:
Tensorshape由参数 `n` 决定。