TorchLean API

NN.API.Models.Cnn

Convolutional Classifier #

The classifier is polymorphic in the number of spatial axes. Its input has shape (batch, channels, spatial...); convolution and pooling use the same vector-valued configuration for signals, images, volumes, and higher-dimensional data.

Configuration for a compact convolutional classifier.

  • batch :

    Number of independent samples processed together.

  • inChannels :

    Number of channels in each input sample.

  • spatial : Vector d

    Extent of each spatial axis.

  • outDim :

    Number of classifier outputs per sample.

  • conv : Conv d

    Convolution stage.

  • pool : Pool d

    Max-pooling stage.

Instances For

    Spatial extent after convolution.

    Instances For

      Spatial extent after pooling.

      Instances For

        Number of features presented to the classifier head.

        Instances For

          Input tensor shape (batch, inChannels, spatial...).

          Instances For

            Classifier output shape (batch, outDim).

            Instances For
              def TorchLean.nn.models.cnn {d : } (cfg : CnnConfig d) (hInChannels : cfg.inChannels 0 := by decide) :

              Build convolution -> activation -> max pool -> flatten -> linear.

              Instances For