dropout¶
dragon.nn.
dropout
(
inputs,
ratio=0.5,
inplace=False,
**kwargs
)[source]¶Set the elements of 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{ratio})) \]Examples:
x = dragon.ones((2, 3), 'float32') print(dragon.nn.dropout(x, ratio=0.5))
- Parameters:
- inputs (dragon.Tensor) – The input tensor.
- ratio (Union[float, dragon.Tensor], optional, default=0.5) – The probability to zero an element.
- inplace (bool, optional, default=False) – Call in-place or return a new tensor.
- Returns:
dragon.Tensor – The output tensor.