TorchLean API

NN.API.Runtime

Runtime Selection #

Arithmetic semantics, device, and backend-contract inspection.

map batchShape input f applies a reference-valued operation to each sample without fixing the batch rank. linear (batchShape := ...) applies an affine map to the final feature axis.

@[reducible, inline]

Arithmetic semantics and device for a run. The record is defined with the Torch runtime; this is the name the public API uses, so user code never spells Runtime.Autograd.Torch to configure a run.

Instances For
    @[reducible, inline]
    abbrev TorchLean.Runtime.ValueRef (m : Type → Type) (α : Type) [Storage α] [Context α] [Monad m] [Ops m α] (shape : Shape) :

    A shape-indexed handle to a value owned by a runtime program.

    Unlike Tensor, a ValueRef does not contain tensor elements. It names an intermediate value in an eager session or typed graph and is valid only in the program that created it.

    Instances For
      def TorchLean.Runtime.linear {α : Type} [Storage α] [Context α] {m : Type → Type} [Monad m] [Ops m α] (batchShape : Shape := []) {inputWidth outputWidth : ℕ} (weight : ValueRef m α [outputWidth, inputWidth]) (bias : ValueRef m α [outputWidth]) (input : ValueRef m α (batchShape.appendDim inputWidth)) :
      m (ValueRef m α (batchShape.appendDim outputWidth))

      Apply an affine map to the final axis, independently over every index in batchShape.

      Instances For

        Operation-Polymorphic Programs #

        These operations build or execute runtime programs. They consume shape-indexed references rather than materialized Tensor values, so they live under Runtime instead of the pure tensor API. Ordinary models should use nn and Trainer; this lower-level surface is useful for custom losses, verification programs, and graph-lowering tools.

        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

          Plan operations under the runtime-selected backend-contract profile; inference planning passes gradEnabled := false.

          Instances For