TorchLean API

NN.Proofs.Autograd.Tape.Algebra.Contributions

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.

@[reducible, inline]

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
      def Proofs.Autograd.Algebra.TensorLookup.add {α : Type} [TorchLean.Storage α] {shapes : List Spec.Shape} [Add α] (left right : TensorLookup α shapes) :
      TensorLookup α shapes

      Pointwise addition retains left-to-right scalar argument order.

      Instances For
        @[simp]
        theorem Proofs.Autograd.Algebra.TensorLookup.ofPack_add {α : Type} [TorchLean.Storage α] {shapes : List Spec.Shape} [Add α] (left right : TorchLean.TensorPack α shapes) :
        ofPack (left.add right) = (ofPack left).add (ofPack right)

        A dense VJP program with a certified compact description of its entries.

        Instances For

          The original all-zero pack, with its explicit uniform contribution retained.

          Instances For
            def Proofs.Autograd.Algebra.Contributions.add {α : Type} [TorchLean.Storage α] {shapes : List Spec.Shape} [Add α] (left right : Contributions α shapes) :
            Contributions α shapes

            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.

            Instances For