mindspore.ops.DropoutGenMask
- class mindspore.ops.DropoutGenMask(*args, **kwargs)[source]
Generates the mask value for the input shape.
Droupt means tha neural network units are temporarily dropped from the network according to a certain probability during the deep learning network training. Generally, The effect of Dropout is the same as that of DropoutGenMask and DropoutDoMask. The DropoutGenMask generates a mask shape that is specified based on the input. Next, The DropoutDoMask is a mask generated using DropoutGenMask. The input tensor is randomly set to zero based on the probability p.
- Parameters
- Inputs:
shape (tuple[int]) - The shape of target mask.
keep_prob (Tensor) - The keep rate, greater than 0 and less equal than 1, e.g. keep_prob = 0.9, means dropping out 10% of input units.
- Outputs:
Tensor, the value of generated mask for Inputs shape.
- Raises
- Supported Platforms:
Ascend
Examples
>>> dropout_gen_mask = ops.DropoutGenMask() >>> shape = (2, 4, 5) >>> keep_prob = Tensor(0.5, mindspore.float32) >>> output = dropout_gen_mask(shape, keep_prob) >>> print(output.shape) (16,)