mindspore.ops.RandomChoiceWithMask

class mindspore.ops.RandomChoiceWithMask(count=256, seed=0, seed2=0)[源代码]

对输入进行随机取样,返回取样索引和掩码。

更多参考详见 mindspore.ops.choice_with_mask()

支持平台:

Ascend GPU CPU

样例:

>>> rnd_choice_mask = ops.RandomChoiceWithMask()
>>> input_x = Tensor(np.ones(shape=[240000, 4]).astype(np.bool))
>>> output_y, output_mask = rnd_choice_mask(input_x)
>>> result = output_y.shape
>>> print(result)
(256, 2)
>>> result = output_mask.shape
>>> print(result)
(256,)