TorchLean API

NN.IR.Payload

IR Payloads #

Shared payload records for IR evaluators and verifier backends.

The graph stores operation names and edges. Tensor-valued constants, weights, convolution kernels, and BatchNorm running statistics live in a separate payload keyed by node id, matching the way formats such as ONNX keep graph structure separate from initializers.

structure NN.IR.ConstFlat (α : Type) [TorchLean.Storage α] [Context α] :

Payload record for a const node.

Constants are stored in a flat representation so backends can use one vector container and let IR evaluation reshape the data to the node's declared output shape.

  • n :

    Number of scalar entries stored in the flat constant payload.

  • v : TorchLean.Tensor α [self.n]

    Constant values stored as a vector before evaluation reshapes them to the IR node shape.

Instances For
    structure NN.IR.LinearWB (α : Type) [TorchLean.Storage α] [Context α] :

    Payload record for a linear node: weight matrix W and bias vector b.

    The node's input x comes from the graph edge; W,b live in the external Payload, similar to ONNX initializers or a PyTorch state_dict.

    Instances For
      structure NN.IR.ConvParams (α : Type) [TorchLean.Storage α] [Context α] :

      Payload for an arbitrary-dimensional convolution node.

      Instances For

        Whether a convolution payload implements the geometry declared by an IR node.

        Instances For
          def NN.IR.ConvParams.input {α : Type} [TorchLean.Storage α] [Context α] (params : ConvParams α) (leading : Spec.Shape) :

          Input shape expected by a convolution payload after preserving the graph's leading axes.

          Instances For
            def NN.IR.ConvParams.output {α : Type} [TorchLean.Storage α] [Context α] (params : ConvParams α) (leading : Spec.Shape) :

            Output shape produced by the typed convolution payload for the given leading axes.

            Instances For

              Payload for eval-mode BatchNorm along a channel axis selected by the graph node.

              Instances For

                Affine parameters and epsilon for LayerNorm over an arbitrary normalized suffix.

                Instances For
                  structure NN.IR.Payload (α : Type) [TorchLean.Storage α] [Context α] :

                  External parameter payloads keyed by IR node id.

                  This is focused on denotational IR evaluation. Runtime backends may store tensors differently, but their proof layer semantics pass through this shape-indexed boundary.

                  Instances For