Eager Trainer #
Record each forward pass on a fresh tape. CUDA updates keep gradients and optimizer moments on the device; only requested losses and state reads cross back to the host.
def
Runtime.Autograd.Torch.Internal.eagerScalarTrainer
{α δ : Type}
[TorchLean.Storage α]
[TorchLean.Storage δ]
[Context α]
[TensorTransfer α]
{paramShapes inputShapes dataInputShapes : List Spec.Shape}
(options : Config)
(parameters : ParamList α paramShapes)
(validateDataInputsIO : TorchLean.TensorPack δ dataInputShapes → IO Unit)
(loss : ScalarLoss α δ paramShapes inputShapes dataInputShapes)
:
IO (ScalarTrainer α δ paramShapes inputShapes dataInputShapes)
Construct the eager CPU or CUDA backend for a scalar trainer.