mindspore.ops.Dropout3D

class mindspore.ops.Dropout3D(*args, **kwargs)[source]

During training, randomly zeroes some of the channels of the input tensor with probability 1-keep_prob from a Bernoulli distribution.

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:
  • input (Tensor) - A 5-D tensor with shape \((N, C, D, H, W)\).

Outputs:
  • output (Tensor) - with the same shape and data type as the input tensor.

  • mask (Tensor[bool]) - with the same shape as the input tensor.

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

Examples

>>> dropout = ops.Dropout3D(keep_prob=0.5)
>>> x = Tensor(np.random.randn(2, 1, 2, 1, 2), mindspore.float32)
>>> output, mask = dropout(x)
>>> print(output)
[[[[[0. 0.]]
   [[0. 0.]]]]
 [[[[-2.98 -0.01]]
   [[-0.34 1.57]]]]]
>>> print(mask)
[[[[[False False]]
   [[False False]]]]
 [[[[True True]]
   [[True True]]]]]