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.
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
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.
- outDim : ℕ
Output dimension.
- inDim : ℕ
Input dimension.
- b : TorchLean.Tensor α [self.outDim]
Bias vector added after matrix-vector multiplication.
Instances For
Payload for an arbitrary-dimensional convolution node.
- spatialRank : ℕ
Number of spatial axes.
- inChannels : ℕ
Input channels.
- outChannels : ℕ
Output channels.
- kernel : TorchLean.Tensor ℕ [self.spatialRank]
Per-axis kernel extents.
- stride : TorchLean.Tensor ℕ [self.spatialRank]
Per-axis strides.
- padding : TorchLean.Tensor ℕ [self.spatialRank]
Zero padding before each spatial axis.
- dilation : TorchLean.Tensor ℕ [self.spatialRank]
Spacing between adjacent kernel samples.
- paddingAfter : TorchLean.Tensor ℕ [self.spatialRank]
Zero padding after each spatial axis.
paddingis the padding before the input. - groups : ℕ
Number of independent channel groups.
- inputSpatial : TorchLean.Tensor ℕ [self.spatialRank]
Spatial shape of one input sample.
Every kernel extent is nonzero.
Every stride is nonzero.
- spec : Spec.ConvSpec self.spatialRank self.inChannels self.outChannels self.kernel self.stride self.padding α
Typed weights, bias, and convolution geometry.
Instances For
Whether a convolution payload implements the geometry declared by an IR node.
Instances For
Input shape expected by a convolution payload after preserving the graph's leading axes.
Instances For
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.
- c : ℕ
Channel count.
- gamma : TorchLean.Tensor α [self.c]
Affine scale.
- beta : TorchLean.Tensor α [self.c]
Affine bias.
- mean : TorchLean.Tensor α [self.c]
Running mean.
- var : TorchLean.Tensor α [self.c]
Running variance.
- eps : α
Epsilon added to the running variance before taking the square root.
Instances For
Affine parameters and epsilon for LayerNorm over an arbitrary normalized suffix.
- normalizedShape : Spec.Shape
Shape of the suffix normalized by the corresponding node.
- gamma : TorchLean.Tensor α self.normalizedShape
Learned elementwise scale over
normalizedShape. - beta : TorchLean.Tensor α self.normalizedShape
Learned elementwise bias over
normalizedShape. - eps : α
Epsilon added to the variance before taking the square root.
Instances For
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.
Flat constants keyed by the
constnode id.Linear weights and bias keyed by the
linearnode id.- conv? : ℕ → Option (ConvParams α)
Convolution parameters keyed by the
convnode id. - batchNormEval? : ℕ → Option (BatchNormEvalParams α)
Eval-mode BatchNorm parameters keyed by the
batchNormEvalnode id. - layerNorm? : ℕ → Option (LayerNormParams α)
Affine LayerNorm parameters keyed by the
layernormnode id.