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.
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
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)
:
M (Sequential (cnnInShape cfg) (cnnOutShape cfg))
Build convolution -> activation -> max pool -> flatten -> linear.