# mindspore.ops.Dropout3D

class mindspore.ops.Dropout3D(keep_prob=0.5)[source]

During training, randomly zeroes some of the channels of the input tensor with probability 1-keep_prob from a Bernoulli distribution(For a 5-dimensional tensor with a shape of NCDHW, the channel feature map refers to a 3-dimensional feature map with a shape of DHW).

For example, the $$j_th$$ channel of the $$i_th$$ sample in the batched input is a 3D tensor input[i,j,k]. Each channel will be zeroed out independently on every forward call with probability 1-keep_prob using samples from a Bernoulli distribution.

Dropout3D can improve the independence between channel feature maps.

Parameters

keep_prob (float) – The keep probability of a channel, between 0 and 1, e.g. keep_prob = 0.8, means dropping out 20% of channels. Default: 0.5.

Inputs:
• x (Tensor) - A 5-D tensor with shape $$(N, C, D, H, W)$$, where N is the batch size, C is the number of channels, D is the feature depth, H is the feature height, and W is the feature width. The data type should be int8, int16, int32, int64, float16 or float32.

Outputs:
• output (Tensor) - With the same shape and data type as x.

• mask (Tensor) - With the same shape as x and the data type is bool.

Raises
• TypeError – If the data type of keep_prob is not float.

• ValueError – If keep_prob is out of the range [0.0, 1.0]; or if the dim of input is not 5-D.

Supported Platforms:

Ascend GPU

Examples

>>> dropout = ops.Dropout3D(keep_prob=0.5)
>>> x = Tensor(np.ones([2, 1, 2, 1, 2]), mindspore.float32)