TorchLean API

NN.API.Models.Resnet

ResNet Model Helpers (API) #

This module provides a ResNet-style classifier constructor used by runnable examples.

The architecture is small enough to keep the Lean shape arguments readable while still following the standard ResNet pattern:

The positivity proofs below are Lean's way of recording that pooling axes are nonempty. The public constructor is nn.models.resnet cfg; executable examples can decide separately whether this heavier residual path belongs in their runtime budget.

Configuration for a ResNet-style image classifier.

Instances For

    Channel count of the second ResNet stage.

    Instances For

      Spatial height after the downsampling block.

      Instances For

        Spatial width after the downsampling block.

        Instances For
          @[reducible, inline]

          Batched image input shape for the ResNet helper.

          Instances For
            @[reducible, inline]

            Batched classifier-logit output shape for the ResNet helper.

            Instances For
              def NN.API.nn.models.resnet (cfg : ResnetConfig) (h_batch : cfg.batch 0 := by decide) (h_inC : cfg.inC 0 := by decide) (h_inH : cfg.inH 0 := by decide) (h_inW : cfg.inW 0 := by decide) (h_stemC : cfg.stemC 0 := by decide) (h_stage2C : cfg.stage2C 0 := by decide) :

              Build a ResNet-style image classifier.

              Architecture: conv3x3 stem -> batch norm -> ReLU -> basic block -> downsampling basic block -> basic block -> global average pool -> linear head.

              The explicit proof arguments are optional defaults. For concrete model configs they are solved by by decide; keeping them here hides the proof arguments from runnable examples.

              Instances For