mindspore.ops.RandomChoiceWithMask

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

Generates a random sample as index tensor with a mask tensor from a given tensor.

Refer to mindspore.ops.choice_with_mask() for more details.

Supported Platforms:

Ascend GPU CPU

Examples

>>> 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,)