Nested forward-mode inputs #
Each layer of Dual.Nested α n carries one independent differentiation direction. The last
direction is outermost: for two directions the input is ⟨⟨x, v⟩, ⟨w, 0⟩⟩. The first listed
direction is therefore innermost. Keeping this order matters for backends whose arithmetic
is not associative.
Seeding and extraction work for every runtime scalar context. Their exact-real derivative
interpretation is proved separately in NN.Proofs.Autograd.Dual.
The runtime dual carrier nested once for each differentiation direction.
Instances For
Preserve the base backend's storage at order zero; dual layers use array storage.
Reuse the scalar backend's arithmetic at every level of nesting.
Embed a constant in all primal slots and set its derivative coefficients to zero.
Instances For
Zero gradient buffers have the same representation at every nesting depth.
Seed constant directions; the last direction occupies the outermost dual layer.
Instances For
Extract the coefficient containing every differentiation direction exactly once.
Instances For
Zero directions give the same coefficients as a constant embedding.
Seed a direction tuple of arbitrary tensor shape, coordinate by coordinate.
Instances For
Extract the mixed derivative coefficient at every output coordinate.
Instances For
Seeding preserves the supplied value and directions at every tensor coordinate.
A tensor with zero directions is held constant at every nesting depth.
Tensor extraction reads exactly the scalar coefficient at each coordinate.
Adding a direction uses the existing one-step tensor seeding operation.