Executable Module Commands #
Command-line support for executable TorchLean programs, including arithmetic and device selection, help output, seed parsing, banners, and exit codes.
Runtime choices parsed from the shared command-line flags.
- arithmetic : Runtime.Arithmetic
Arithmetic semantics for this execution.
- execution : Runtime.Autograd.Torch.ExecutionMode
Immediate or typed-graph execution.
- device : NN.Backend.Device
Requested execution device.
- showBackend : Bool
Whether to print each backend capsule when first used.
Instances For
Instances For
Instances For
Parse the shared arithmetic, execution, device, and backend-reporting flags.
Named devices without an installed runtime remain parseable so diagnostics can report the intended
target. Runtime.Config.validateForExecution rejects such a configuration before execution.
Instances For
Convert parsed command-line choices to an explicit runtime configuration.
Instances For
Print the selected arithmetic, execution strategy, and device.
Instances For
Parse the shared runtime flags, select executable arithmetic, and call continuation with the
corresponding literal conversion and explicit runtime options.
Instances For
Runtime properties required by an executable command.
- device? : Option NN.Backend.Device
Required execution device, or no device restriction.
- execution? : Option Runtime.Autograd.Torch.ExecutionMode
Required execution strategy, or no execution-strategy restriction.
Instances For
Supply required runtime flags only when the caller did not choose them explicitly.
Instances For
Reject a parsed runtime selection that conflicts with the command's requirements.
Instances For
Banner, success-message, and flushing configuration for an executable command.
Command-specific help text; the generic runtime help is used when absent.
- flush : Bool
Flush stdout after printing the banner, when present.
- printSuccess : Bool
Print
"{exeName}: ok"after successful execution. - runtime : RuntimeRequirements
Device or execution-mode requirements imposed by this command.
Instances For
Print the configured executable banner, if one was supplied.
Instances For
How an executable command chooses its arithmetic semantics.
- selectedArithmetic
(continuation :
{α : Type} →
[Storage α] →
[Context α] → [ToString α] → [Runtime.FromFloat α] → (Float → α) → Runtime.Config → List String → IO Unit)
: Action
Allow arithmetic selection; the continuation must work for every executable backend.
- native
(continuation : Runtime.Config → List String → IO Unit)
: Action
Run a command fixed to native arithmetic rather than exposing arithmetic selection.
Instances For
Generic help text for executables built on TorchLean.Module.Command.run.
Instances For
Run a TorchLean executable after parsing the shared seed and runtime flags.
The selected seed initializes TorchLean's global random stream and is also stored in
Runtime.Config, so
model initialization and either execution mode observe the same seed.