Indexed tensor lookup and an array context shared by forward graphs and algebraic tapes. The correspondence certificate is erased at runtime; reads select tensors without traversing a linked pack. Conversion to a pack happens at an explicit typed boundary.
Tensor selection without committing a node to a linked pack representation.
- read {shape : Spec.Shape} : Idx shapes shape → TorchLean.Tensor α shape
Select the tensor with the shape certified by its index.
Instances For
Present a linked tensor pack through the selection interface.
Instances For
Typed packs can supply a node's lookup without changing tensor values.
Reading a pack through the lookup agrees with its typed selection.
Materialize a reader at an explicit typed boundary.
Instances For
Equal context positions certify equal tensor shapes.
Replace one typed entry of a reader.
Instances For
Erasing shapes removes the transport in a reader update.
Updating from another reader copies exactly that reader's value at the selected position.
Runtime tensor references with an erased certificate of their shapes and order.
- values : Array (Spec.SomeTensor α)
Inputs followed by node values in evaluation order.
- valid : ∃ (xs : TorchLean.TensorPack α shapes), self.values = xs.toShapeErasedArray
Every runtime entry has the shape at the same position in the typed context.
Instances For
Convert input tensors once, before traversing the graph.
Instances For
Runtime and typed contexts have the same number of entries.
Read a previously checked position in constant time.
Instances For
Array lookup agrees with the original typed pack lookup.
Update one tensor reference without copying the context when it is uniquely owned.
Instances For
Transport the type index without changing the runtime array.
Instances For
Append a tensor reference, amortized constant time when the context is uniquely owned.
Retaining a previous context or its lookup can make this append copy the shared array.
Instances For
Remove the last reference in constant time, preserving the typed prefix.
Instances For
Recover the public typed result once at the execution boundary.