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 Summary

    Constructors
    Constructor
    Description
    Conv2dLayer(int in, int out, int kernel, int stride, int padding, int dilation, int groups, boolean bias, String paddingMode)
    Constructor.
    Conv2dLayer(int in, int out, int kernel, int stride, String padding, int dilation, int groups, boolean bias, String paddingMode)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bytedeco.pytorch.Module
    Returns the PyTorch Module object.
    forward(Tensor input)
    Forward propagation (or forward pass) through the layer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface smile.deep.layer.Layer

    apply, to, to
  • 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.