mindspore.ops.Dropout2D
- class mindspore.ops.Dropout2D(keep_prob=0.5)[source]
During training, randomly zeroes some channels of the input tensor with probability 1-keep_prob from a Bernoulli distribution(For a 4-dimensional tensor with a shape of NCHW, the channel feature map refers to a 2-dimensional feature map with the shape of HW).
Dropout2D can improve the independence between channel feature maps.
Refer to
mindspore.ops.dropout2d()
for more detail.Note
The keep probability \(keep_prob\) is equal to ‘ops.dropout2d’ input ‘1-p’.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from mindspore.ops.operations.nn_ops import Dropout2D >>> dropout = Dropout2D(keep_prob=0.5) >>> x = Tensor(np.ones([2, 1, 2, 3]), mindspore.float32) >>> output, mask = dropout(x) >>> print(output.shape) (2, 1, 2, 3)