TorchLean API

NN.Examples.Quickstart.SimpleCnnTrain

Simple CNN training example #

This is the small image-classification counterpart to SimpleMlpTrain.lean.

It remains in Quickstart as a next-step file for users who have finished the core five-file path (TensorBasics, Widgets, AutogradBasics, SimpleMlpTrain, Proofs). For broader maintained vision models, prefer NN/Examples/Models.

It uses the same public training API:

  1. define a SeqTask,
  2. build samples,
  3. call fit,
  4. inspect loss / accuracy.

The only difference is the model and the sample shape.

Check this tutorial module directly:

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

Optional flags:

Public API used here:

Reader note:

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

def NN.Examples.Quickstart.SimpleCNNTrain.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) :
Instances For