TorchLean API

NN.API.Public.Facade.Trainer.Constructor

TorchLean Trainer Construction #

Public constructors for the unified trainer handle.

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

Values that can be used as public trainer models.

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 one unified public trainer from a sequential model or seedable model builder.

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

      Public trainer type carrying a model, task, runtime configuration, and seed.

      Instances For