TorchLean Module Runtime Facade #
Executable module operations for advanced runtime and example code.
Executable module instance with mutable runtime parameters and optimizer state.
Instances For
Instantiate an executable runtime module from a public ScalarModuleDef.
This is the generic public entrypoint for custom runtime tasks outside the standard supervised
module constructors such as Module.instantiateMse or Module.instantiateCrossEntropyOneHot.
Instances For
Run one inference step through a supervised runtime module.
This is the public sibling of the direct runtime pattern
nn.eval1 opts model m.trainer.params x.
Instances For
Run one no-grad inference step through a supervised runtime module.
Use this for sampling/reporting paths that should not build an autograd tape.
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 nn.Sequential model surface but needs a custom
loss/module definition instead of the standard MSE or cross-entropy module constructors.
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.
This is the custom-loss sibling of withMseModel / withCrossEntropyOneHotModel. Use it when the
model is ordinary nn.Sequential, but the loss needs task-specific logic beyond the standard MSE or
cross-entropy module constructors.
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.
This is the generic bridge for custom training loops: richer examples can keep their own control
flow while still choosing SGD/Adam/AdamW through the same optim.* config surface as
Trainer.RunConfig.
Instances For
Create a sample-step function from the public optimizer config used by the trainer API.
This is the bridge for custom training loops: richer examples can keep their own control flow while
still choosing SGD/Adam/AdamW through the same optim.* config surface as Trainer.RunConfig.