mindspore/docs/api/api_python/ops/mindspore.ops.Randperm.rst

24 lines
972 B
ReStructuredText
Raw 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:class:: mindspore.ops.Randperm(max_length=1, pad=-1, dtype=mstype.int32)
生成从0到n-1不重复的n个随机样本。如果 `max_length` > n则末尾的 `max_length-n` 个元素使用 `pad` 填充。
参数:
- **max_length** (int) - 取样数量必须大于0。默认值1。
- **pad** (int) - 填充值。默认值:-1。
- **dtype** (mindspore.dtype) - 输出的数据类型。默认值mindspore.int32。
输入:
- **n** (Tensor[int32]) - shape为 :math:`(1,)` 的输入Tensor须在[0, `max_length`]内取值。
输出:
- **output** (Tensor) - shape: (`max_length`,),数据类型为 `dtype`
异常:
- **TypeError** - `max_length``pad` 不是int类型。
- **TypeError** - `n` 不是Tensor。
- **TypeError** - `n` 包含非int元素。
- **TypeError** - `n` 包含负数。