Training Results #
Regression, cross-entropy, and custom losses all return the same trained-model type.
A Result keeps a parameter snapshot of the trained model. Prediction and verification use it
directly. Result.state retains the session's public scalar and Result.save writes its exact
encoding with Checkpoint.State.save. Results are produced by Session.finish; verification is
available when the opening path supplies a verifier for its runtime scalar.
A trained TorchLean model.
The result retains its parameter snapshot through prediction, state-reading, and verification closures. Continued training of the source session does not change the result.
The default public scalar is Float: ordinary sessions read binary32 state back exactly. Typed
sessions retain their selected scalar through state, prediction, reporting, and checkpoint encoding.
- reportValue : TorchLean.Trainer.Report α
- readState : IO (TorchLean.nn.State α self.stateShapes)
- saveState : System.FilePath → IO Unit
- predictOne : TorchLean.Tensor α σ → IO (TorchLean.Tensor α τ)
- runVerification? : Option (TorchLean.Tensor Float σ → Float → TorchLean.Verification.Norm → TorchLean.Verification.Property → TorchLean.Verification.Algorithm → IO TorchLean.Verification.Report)
Instances For
Construct an opaque trained-model result at the trainer implementation boundary.
Read the trained parameters and persistent buffers in the session's public scalar.
Ordinary sessions read binary32 state back to Float exactly; typed sessions preserve α.
The layout result.stateShapes equals nn.stateShapes of the trained model, which is what
Checkpoint.State.save and Checkpoint.State.load expect.
Save the trained state with Checkpoint.State.save.
Restore it with Session.load on a session using the same scalar. For typed state, open that
session with trainer.openTyped (α := α) before loading the checkpoint.
Run evaluation-mode prediction through the trained snapshot.
batch := true maps over a leading axis of length batchSize, including an empty axis.
Verify the trained model over a region around center.
property and algorithm have defaults, so checking output bounds needs only center and
radius. This fails explicitly if the opening path supplied no verifier, including openTyped.
A trained model returned by step-indexed stream training.
Generated or resampled workloads may not have one static dataset to summarize. The ordinary training
result is paired with the evaluation curve collected from a caller-provided sample. Predictions
retain the result's scalar α; the recorded curve uses Float metrics.
- trained : Result σ τ α
Trained model result.
- curve : Training.Curve
Evaluation loss curve recorded during stream training.
Instances For
One-line summary for the trained stream run.
Instances For
Print the stream training summary.
Instances For
Predict one input, or map a leading tensor batch, through the trained stream result.
Instances For
Two trained regression models and the coupled metric recorded by alternating updates.
Trained result for the first model.
Trained result for the second model.
- curve : Training.Curve
Task-specific curve recorded by the caller-provided evaluation function.
Instances For
One-line summary for the two trained models.
Instances For
Print the training summary for both models.
Instances For
Print the endpoints of the coupled metric curve.