Executable Modules #
Executable module operations for manual runtime and example code.
Instantiate an executable runtime module from a ScalarModuleDef.
This handles custom runtime tasks that do not use the standard supervised constructors such as
Module.instantiateMse or Module.instantiateCrossEntropyOneHot.
Instances For
Run one inference step through a supervised runtime module.
Public sibling of the direct runtime pattern model.predict opts m.trainer.params x.
Instances For
Instantiate a supervised MSE module directly from a sequential model.
Instances For
Instantiate a supervised one-hot cross-entropy module directly from a sequential model.
Instances For
Instantiate a custom supervised runtime module directly from a sequential model.
Use this when a public example keeps the ordinary TorchLean.nn.Sequential model API but needs a custom
loss/module definition instead of the standard MSE or cross-entropy module constructors.
Instances For
Float specialization of instantiateModuleDefModel with storage-first initialization.
Instances For
Instantiate the standard PPO actor-critic supervised runtime module from rollout-shaped actor and critic networks.
Instances For
Build a sequential model, instantiate a one-hot cross-entropy runtime module for it, and continue with both values.
This packages the common public example pattern
nn.withModel mkModel fun model => let m ← Module.instantiateCrossEntropyOneHot ....
Instances For
Build a sequential model, instantiate an MSE runtime module for it, and continue with both values.
Instances For
Build a sequential model, instantiate a custom supervised runtime module for it, and continue with both values.
This packages the common public example pattern
nn.withModel mkModel fun model => let m ← Module.instantiate ... (moduleDefOf model).
Instances For
Build a sequential model, instantiate a runtime module for a custom scalar loss program, and continue with both values.
Custom-loss sibling of withMseModel / withCrossEntropyOneHotModel. Use it when the model is
ordinary TorchLean.nn.Sequential, but the loss needs task-specific logic beyond the standard MSE or
cross-entropy module constructors.
Instances For
Float specialization of withScalarLossModel with storage-first parameter initialization.
Instances For
Evaluate one supervised sample through a runtime module and return the scalar loss value.
This packages the common public example pattern Module.forward ...; Tensor.toScalar.
Instances For
Create an Adam optimizer handle bound to a concrete runtime module.
This packages the common public example pattern optim.runtimeAdam ...; optim.handle m opt.
Instances For
Create an AdamW optimizer handle bound to a concrete runtime module.
Instances For
Create an SGD optimizer handle bound to a concrete runtime module.
Instances For
Create a one-step update function for any typed module input pack from the public optimizer config used by the trainer API.
Generic bridge for custom training loops: richer examples can keep their own control flow while
still choosing a public optim.* config through the same API as Trainer.RunConfig.
Instances For
Create a sample-step function from the public optimizer config used by the trainer API.
Bridge for custom training loops: richer examples can keep their own control flow while still
choosing a public optim.* config through the same API as Trainer.RunConfig.