TorchLean API

NN.API.Trainer.Constructor

Trainer Construction #

Constructors for the trainer handle.

class TorchLean.Trainer.ToModel (model : Type u) (σ τ : outParam Shape) :
Type (max 2 u)

Values accepted by Trainer.new.

This class lets Trainer.new accept either a seedable model builder or an already-built checked model:

Trainer.new modelBuilder ...
Trainer.new alreadyBuiltModel ...

The seed is consumed only by the builder case. Already-built models pass through unchanged.

  • build : modelnn.Sequential σ τ

    Materialize the model, using the seed only when the value still needs initialization.

Instances
    @[implicit_reducible]
    @[implicit_reducible]
    def TorchLean.Trainer.new {model : Type u} {σ τ : Shape} [ToModel model σ τ] (m : model) (cfg : Config σ τ := { }) :
    Handle σ τ

    Build a trainer from a sequential model or seedable model builder.

    Instances For
      @[reducible, inline]
      abbrev TorchLean.Trainer (σ τ : Shape) :

      Trainer type carrying a model, task, runtime configuration, and seed.

      Instances For