Dropout

class dragon.vm.torch.nn.Dropout(
  p=0.5,
  inplace=False
)[source]

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

The Dropout function is defined as:

\[\text{Dropout}(x) = x * \text{Bernoulli}(p=1 - prob) \]

Examples:

# Dropout is enabled if the module is at ``training``
m = torch.nn.Dropout(p=0.5, inplace=True)
x = torch.ones(2, 3)
y = m(x)

# Nothing will happen if it set to ``evaluating``
m.eval()
z = m(x)

__init__

Dropout.__init__(
  p=0.5,
  inplace=False
)[source]

Create a Dropout module.

Parameters:
  • p (float, optional, default=0.5) – The dropping prob.
  • inplace (bool, optional, default=False) – Whether to do the operation in-place.