TorchLean API

NN.API.Runtime

Runtime Selection #

Dtype, backend, device, and runtime-selection helpers.

@[reducible, inline]

Runtime execution strategy: eager evaluation or compiled graph execution.

Instances For
    @[reducible, inline]

    Physical or logical device selected for runtime execution.

    Instances For

      Parse a public device selector. auto chooses the portable CPU runtime; every other value is validated against the devices known to the backend registry.

      Instances For
        def TorchLean.Runtime.runFloat (exeName : String) (args : List String) (banner : OptionsString) (k : OptionsList StringIO Unit) (printOk : Bool := true) :

        Parse the usual TorchLean runtime flags and run a Float callback.

        Examples should use this instead of calling TorchLean.Module.run directly; that lower-level dispatcher is what backs this wrapper.

        Instances For
          def TorchLean.Runtime.runCudaFloat (exeName : String) (args : List String) (banner : OptionsString) (k : OptionsList StringIO Unit) (printOk : Bool := true) :

          Run a Float command on CUDA, adding --device cuda when no device was supplied.

          Instances For
            def TorchLean.Runtime.runCudaEagerFloat (exeName : String) (args : List String) (banner : OptionsString) (k : OptionsList StringIO Unit) (printOk : Bool := true) :

            Run a Float command on the eager CUDA runtime.

            Instances For

              Parse the standard TorchLean runtime flags and return the resulting Options.

              Non-polymorphic sibling of Runtime.withOptions: examples that always run at Float can still parse --device, --backend, and --dtype without exposing a polymorphic callback.

              Instances For

                Backend-contract profile corresponding to the selected runtime options.

                Instances For

                  Plan operations under the runtime-selected backend-contract profile.

                  Instances For

                    Print the selected backend capsules for operations.

                    Instances For
                      def TorchLean.Runtime.withOptions (args : List String) (k : {α : Type} → [Context α] → [DecidableEq Spec.Shape] → [ToString α] → [FromFloat α] → (Floatα)OptionsList StringIO Unit) :

                      Run an example under the selected runtime and pass through the parsed runtime options.

                      Use this when an example needs to inspect --backend, --device, or similar flags after TorchLean has selected the scalar backend.

                      Instances For
                        def TorchLean.Runtime.withOptionsScalar (args : List String) (k : {α : Type} → [Context α] → [DecidableEq Spec.Shape] → [ToString α] → [FromFloat α] → OptionsList StringIO Unit) :

                        Run an example under the selected runtime and pass through runtime options when the callback does not need an explicit Float-cast function.

                        Instances For
                          def TorchLean.Runtime.runWithDType (title : String) (args : List String) (k : {α : Type} → [Context α] → [DecidableEq Spec.Shape] → [ToString α] → [FromFloat α] → IO Unit) :

                          Run a verification or demo command under the selected runtime dtype.

                          Banner-printing runtime dispatcher matching the convention used by lake exe verify -- ... commands.

                          Instances For