dropout3d¶
- 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 dropout for more details.
- Parameters
-
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, optional) – Probability of setting units to zero. Default: 0.5.
training (bool, optional) – 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
orNDHWC
. When it isNCDHW
, the data is stored in the order of: [batch_size, input_channels, input_depth, input_height, input_width]. Default:NCDHW
.name (str, optional) – Name for the operation, Default: None. For more information, please refer to Name.
- Returns
-
A Tensor representing the dropout3d, has same shape and data type with x .
Examples
>>> import paddle >>> x = paddle.randn(shape=(2, 3, 4, 5, 6)).astype(paddle.float32) >>> y_train = paddle.nn.functional.dropout3d(x) #train >>> y_test = paddle.nn.functional.dropout3d(x, training=False) #test >>> print(x[0,0,:,:,:]) >>> print(y_train[0,0,:,:,:]) # may all 0 >>> print(y_test[0,0,:,:,:])