TorchLean API

NN.API.Models.ResNet

Residual Convolutional Classifier #

The model accepts any batchShape and spatial rank. Residual branches operate on a common typed shape, and global average pooling reduces every spatial axis before the classifier head.

Configuration for a residual classifier over d spatial axes.

  • inputChannels :

    Number of channels in each input sample.

  • spatial : Tensor [d]

    Size of each input axis. Values such as [32, 32] work directly.

  • hiddenChannels :

    Channel width used by the residual trunk.

  • kernelRadius : Tensor [d]

    Radius of the same-padding convolution kernel on each axis.

    A radius of 1 gives the familiar kernel size 3; all convolutions therefore preserve the input grid without an additional shape proof.

  • classCount :

    Number of classifier logits per sample.

Instances For

    Validate the complete residual classifier before allocating any branch parameters.

    Instances For
      @[reducible, inline]
      abbrev TorchLean.nn.models.ResNet.Config.inputShape {d : } (config : Config d) (batchShape : Shape := []) :

      Input tensor shape with an arbitrary batch shape.

      Instances For
        @[reducible, inline]
        abbrev TorchLean.nn.models.ResNet.Config.hiddenShape {d : } (config : Config d) (batchShape : Shape := []) :

        Hidden activation shape shared by the residual branches.

        Instances For
          @[reducible, inline]
          abbrev TorchLean.nn.models.ResNet.Config.outputShape {d : } (config : Config d) (batchShape : Shape := []) :

          Classifier output shape with the same batch shape as the input.

          Instances For
            def TorchLean.nn.models.resnet {d : } (config : ResNet.Config d) (batchShape : Shape := []) :
            Builder (Sequential (config.inputShape batchShape) (config.outputShape batchShape))

            Build a convolutional stem, two residual blocks, global pooling, and a linear classifier.

            Instances For