A VJP can describe a uniform contribution with finitely many exceptions. Its dense program remains available as a compatibility adapter. The certificate preserves the scalar program at every entry; in particular, adding two contributions does not discard zeros or combine repeated parents early.
A typed position whose shape is available without traversing the context's shape list.
Instances For
A reader whose tensors all contain the same scalar.
Instances For
Pointwise addition retains left-to-right scalar argument order.
Instances For
A dense VJP program with a certified compact description of its entries.
- dense : Unit → TorchLean.TensorPack α shapes
The original dense program, evaluated only by the compatibility adapter.
- lookup : TensorLookup α shapes
Constant-time lookup for the small expression formed by one node's VJP.
- uniform : α
Scalar present in tensors at positions outside
support. Positions where the contribution can differ from the uniform tensor.
The compact reader computes exactly the dense VJP.
- outside {shape : Spec.Shape} (idx : Idx shapes shape) : (∀ entry ∈ self.support, ↑entry.snd.i ≠ ↑idx.i) → self.lookup.read idx = TorchLean.Tensor.full shape self.uniform
Every omitted position really is uniform, without assuming any law about zero.
Instances For
The original all-zero pack, with its explicit uniform contribution retained.
Instances For
Add two VJP descriptions in the original order. Duplicate support entries intentionally remain: the reader evaluates the complete local sum before the global gradient receives one contribution.