Class Conv2dLayer

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

public class Conv2dLayer extends Object implements Layer
A convolutional layer.
  • Constructor Details

    • Conv2dLayer

      public Conv2dLayer(int in, int out, int kernel, int stride, int padding, int dilation, int groups, boolean bias, String paddingMode)
      Constructor.
      Parameters:
      in - the number of input channels.
      out - the number of output channels/features.
      kernel - the window/kernel size.
      stride - controls the stride for the cross-correlation.
      padding - controls the amount of padding applied on both sides.
      dilation - controls the spacing between the kernel points.
      groups - controls the connections between inputs and outputs. The in channels and out channels must both be divisible by groups.
      bias - If true, adds a learnable bias to the output.
      paddingMode - "zeros", "reflect", "replicate" or "circular".
    • Conv2dLayer

      public Conv2dLayer(int in, int out, int kernel, int stride, String padding, int dilation, int groups, boolean bias, String paddingMode)
      Constructor.
      Parameters:
      in - the number of input channels.
      out - the number of output channels/features.
      kernel - the window/kernel size.
      stride - controls the stride for the cross-correlation.
      padding - "valid" or "same". With "valid" padding, there's no "made-up" padding inputs. It drops the right-most columns (or bottom-most rows). "same" tries to pad evenly left and right, but if the amount of columns to be added is odd, it will add the extra column to the right. If stride is 1, the layer's outputs will have the same spatial dimensions as its inputs.
      dilation - controls the spacing between the kernel points.
      groups - controls the connections between inputs and outputs. The in channels and out channels must both be divisible by groups.
      bias - If true, adds a learnable bias to the output.
      paddingMode - "zeros", "reflect", "replicate" or "circular".
  • 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.