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.

Note

The keep probability \(keep\_prob\) is equal to \(1 - p\) in mindspore.ops.dropout2d().

Refer to mindspore.ops.dropout2d() for more detail.

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)