TorchLean API

NN.Examples.Quickstart.ResnetBasicblockTrain

ResNet BasicBlock training example (small CHW) #

This next-step file demonstrates the public API.nn.blocks.resnetBasicBlock builder on a small 4×4 "band" dataset (vertical vs horizontal bars).

It is intentionally not part of the first quickstart path. It is here as a compact bridge from the basic MLP/CNN tutorials to the maintained model-zoo ResNet example under NN/Examples/Models.

Note: this particular example uses BatchNorm blocks, so the model is built for a fixed batch size. Most other tutorials in this folder use batch-free models and let API.train.runLoader* lift them.

Check this tutorial module directly:

For the maintained command-line ResNet trainer, use NN/Examples/Models/Vision/Resnet.lean:

Optional flags:

Public API used here:

Reader note:

See NN/Examples/Quickstart/README.md for the shared conventions in this folder.

Why this tutorial exists:

def NN.Examples.Quickstart.ResNetBasicBlockTrain.runOnce {batch : } (task : API.train.Task (Shape.Images batch 1 4 4) (Tensor.shapeOfDims [batch, 2])) {α : Type} [API.Semantics.Scalar α] [DecidableEq Spec.Shape] [ToString α] [API.Runtime.Scalar α] (runner : API.train.Runner α task) (epochs : := 20) (seed : := 0) (quick : Bool := false) :

Run one training session on the small band-image dataset.

This is intentionally separated from main so the tutorial keeps a clean “build task, choose backend, then train” structure.

Instances For