Class DropoutLayer

java.lang.Object
smile.deep.layer.DropoutLayer
All Implemented Interfaces:
Function<Tensor,Tensor>, Layer

public class DropoutLayer extends Object implements Layer
A dropout layer that randomly zeroes some of the elements of the input tensor with probability p during training. The zeroed elements are chosen independently for each forward call and are sampled from a Bernoulli distribution. Each channel will be zeroed out independently on every forward call.

This has proven to be an effective technique for regularization and preventing the co-adaptation of neurons as described in the paper "Improving Neural Networks by Preventing Co-adaptation of Feature Detectors".

  • Constructor Details

    • DropoutLayer

      public DropoutLayer(double p)
      Constructor.
      Parameters:
      p - the dropout probability.
    • DropoutLayer

      public DropoutLayer(double p, boolean inplace)
      Constructor.
      Parameters:
      p - the dropout probability.
      inplace - true if the operation executes in-place.
  • Method Details

    • asTorch

      public org.bytedeco.pytorch.Module asTorch()
      Description copied from interface: Layer
      Returns the PyTorch Module object.
      Specified by:
      asTorch in interface Layer
      Returns:
      the PyTorch Module object.
    • forward

      public Tensor forward(Tensor input)
      Description copied from interface: Layer
      Forward propagation (or forward pass) through the layer.
      Specified by:
      forward in interface Layer
      Parameters:
      input - the input tensor.
      Returns:
      the output tensor.