paddle.nn.functional. dropout3d ( x, p=0.5, training=True, data_format='NCDHW', name=None ) [source]

Randomly zero out entire channels (in the batched input 5d tensor with the shape NCDHW , a channel is a 3D feature map with the shape DHW ). Each channel will be zeroed out independently on every forward call with probability p using samples from a Bernoulli distribution.

See paddle.nn.functional.dropout for more details.

  • x (Tensor) – The input is 5-D Tensor with shape [N, C, D, H, W] or [N, D, H, W, C]. The data type is float32 or float64.

  • p (float) – Probability of setting units to zero. Default 0.5.

  • training (bool) – A flag indicating whether it is in train phrase or not. Default True.

  • data_format (str, optional) – Specify the data format of the input, and the data format of the output will be consistent with that of the input. An optional string from NCDHW or NDHWC. The default is NCDHW . When it is NCDHW , the data is stored in the order of: [batch_size, input_channels, input_depth, input_height, input_width].

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.


A Tensor representing the dropout3d, has same shape and data type with x .


import paddle
import numpy as np

x = np.random.random(size=(2, 3, 4, 5, 6)).astype('float32')
x = paddle.to_tensor(x)
y_train = paddle.nn.functional.dropout3d(x)  #train
y_test = paddle.nn.functional.dropout3d(x, training=False) #test
print(y_train.numpy()[0,0,:,:,:]) # may all 0