mindspore/docs/api/api_python/ops/mindspore.ops.RandomChoiceW...

29 lines
1.1 KiB
ReStructuredText
Raw Normal View History

mindspore.ops.RandomChoiceWithMask
2022-08-30 16:34:32 +08:00
=====================================
.. py:class:: mindspore.ops.RandomChoiceWithMask(count=256, seed=0, seed2=0)
对输入进行随机取样,返回取样索引和掩码。
2022-09-16 15:43:42 +08:00
输入必须是秩不小于1的Tensor。如果其秩大于等于2则第一个维度指定样本数。索引Tensor和掩码Tensor有固定的shape。
索引Tensor为取样的索引掩码Tensor表示索引Tensor中的哪些元素取值为True。
2022-07-26 16:39:37 +08:00
参数:
- **count** (int) - 取样数量必须大于0。默认值256。
- **seed** (int) - 随机种子。默认值0。
- **seed2** (int) - 随机种子2。默认值0。
2022-06-16 17:12:08 +08:00
2022-07-26 16:39:37 +08:00
输入:
- **input_x** (Tensor[bool]) - 输入Tensorbool类型。秩必须大于等于1且小于等于5。
2022-07-26 16:39:37 +08:00
输出:
两个Tensor第一个为索引另一个为掩码。
2022-06-16 17:12:08 +08:00
2022-07-26 16:39:37 +08:00
- **index** (Tensor) - 2维Tensor。
- **mask** (Tensor) - 1维Tensor。
2022-07-26 16:39:37 +08:00
异常:
- **TypeError** - `count` 不是int类型。
- **TypeError** - `seed``seed2` 不是int类型。
- **TypeError** - `input_x` 不是Tensor。