TorchLean API

NN.API.Module.Command

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.

  • Requested execution device.

  • showBackend : Bool

    Whether to print each backend capsule when first used.

Instances For

    Parse the shared arithmetic, 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 and device.

        Instances For
          def TorchLean.Module.withSelectedRuntime (arguments : List String) (continuation : {α : Type} → [Storage α] → [Context α] → [ToString α] → [Runtime.FromFloat α] → (Float → α) → Runtime.Config → List String → IO Unit) :

          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.

            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.

                  • banner? : Option (Runtime.Config → String)

                    Optional banner to print before executing the program.

                  • usage? : Option String

                    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.

                  • Device requirements imposed by this command.

                  Instances For

                    Print the configured executable banner, if one was supplied.

                    Instances For

                      Generic help text for executables built on TorchLean.Module.Command.run.

                      Instances For
                        def TorchLean.Module.Command.run (exeName : String) (arguments : List String) (action : Runtime.Config → List String → IO Unit) (config : Config := { }) :

                        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 training observe the same seed.

                        Instances For