TorchLean API

NN.Proofs.Autograd.FDeriv.TensorVectorization

Continuous tensor vectorization #

The tape's flattened vectors and native real tensors use the same inner product. Bundling the existing conversion as a continuous linear equivalence lets derivatives pass through it without unfolding storage or choosing a second coordinate order. Context projections then return native tensors, including tensors with empty shapes.

The tape's existing tensor conversion as a continuous linear equivalence.

Instances For
    @[simp]

    The bundled map preserves the tape's flattening order.

    @[simp]

    Its inverse uses the existing tensor reconstruction.

    noncomputable def Proofs.Autograd.CtxVec.getTensorCLM {Γ : List Spec.Shape} {shape : Spec.Shape} (input : Idx Γ shape) :

    Read a typed tensor block directly from a flattened context.

    Instances For
      @[simp]
      theorem Proofs.Autograd.CtxVec.getTensorCLM_apply {Γ : List Spec.Shape} {shape : Spec.Shape} (input : Idx Γ shape) (x : CtxVec Γ) :
      (getTensorCLM input) x = getIdx (unflattenCtx x) input

      The continuous projection agrees with tensor-pack indexing after reconstruction.