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_x (Tensor) - A 5-D tensor with shape \((N, C, D, H, W)\). The data type should be int8, int16, int32, int64, float16 or float32

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

  • mask (Tensor[bool]) - with the same shape as the input_x 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 GPU

Examples

>>> dropout = ops.Dropout3D(keep_prob=0.5)
>>> input_x = Tensor(np.random.randn(2, 1, 2, 1, 2), mindspore.float32)
>>> output, mask = dropout(input_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]]]]]