Class BatchNorm2d

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

public final class BatchNorm2d extends Module
Batch normalisation over the channels of NCHW (or NC) input, PyTorch defaults: weight 1, bias 0, running mean 0 and variance 1, momentum 0.1, eps 1e-5. Uses batch statistics in training mode and the running statistics in evaluation mode.
  • Constructor Details

    • BatchNorm2d

      public BatchNorm2d(int channels)
      Batch normalisation over channels channels with PyTorch's defaults (momentum 0.1, eps 1e-5).
    • BatchNorm2d

      public BatchNorm2d(int channels, float momentum, float eps)
      Batch normalisation with the given momentum for the running statistics and eps added to the variance.
  • Method Details

    • runningMean

      public Tensor runningMean()
      The running mean [channels], updated in training mode.
    • runningVar

      public Tensor runningVar()
      The running variance [channels], updated in training mode.
    • 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)), fused into the normalisation kernel.