dropout

dragon.nn.dropout(
  inputs,
  prob=0.5,
  scale=True,
  **kwargs
)[source]

Set the elements of the input to zero randomly. [Srivastava et.al, 2014].

The Dropout function is defined as:

\[\text{Dropout}(x) = x * (r \sim \mathcal{B}(1, 1 - \text{prob})) \]

Examples:

x = dragon.ones((2, 3), 'float32')
print(dragon.nn.dropout(x, 0.5, inplace=False))
Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • prob (Union[float, dragon.Tensor], optional, default=0.2) – The dropping probability.
  • scale (bool, optional, default=True) – Whether to scale the output during training.
Returns:

dragon.Tensor – The output tensor.