Class Conv2d

java.lang.Object
ai.beestream.jitnn.nn.Module
ai.beestream.jitnn.nn.Conv2d
All Implemented Interfaces:
AutoCloseable

public final class Conv2d extends Module
2-D convolution over NCHW with a square kernel, PyTorch's nn.Conv2d semantics and initialisation: weight and bias uniform in [-1/sqrt(fan_in), 1/sqrt(fan_in)), fan_in = in/groups * k * k.
  • Constructor Details

    • Conv2d

      public Conv2d(int in, int out, int kernel, int stride, int padding, long seed)
      A convolution from in to out channels with a kernel x kernel kernel and a bias, no dilation, one group.
    • Conv2d

      public Conv2d(int in, int out, int kernel, int stride, int padding, int dilation, int groups, boolean bias, long seed)
      A convolution from in to out channels in groups groups (both divisible by it), initialised from seed.
  • Method Details

    • weight

      public Tensor weight()
      The weight [out, in/groups, kernel, kernel].
    • bias

      public Tensor bias()
      The bias [out], or null without one.
    • forward

      public Tensor forward(Tensor x)
      Description copied from class: Module
      Applies the module to x.
      Specified by:
      forward in class Module
    • forwardRelu

      public Tensor forwardRelu(Tensor x)
      relu(forward(x)), with the bias and ReLU fused into the convolution's output.