TorchLean API

NN.Proofs.Tensor.AxisLinear

Linear axis permutations #

The softmax axis wrapper moves the selected axis to the last position, applies the row kernel, and restores the axes. Each move only changes which input coordinate an output coordinate reads. Its derivative therefore applies the same permutation to the input direction.

The coordinate maps below follow swapAdjacentAxes and permuteByAdjacentSwaps exactly. They also retain the executable convention for an invalid swap depth: that swap leaves the tensor unchanged. No nonempty-axis assumption is needed.

@[reducible, inline]

Source coordinate read by one adjacent-axis swap.

The derivative proofs and the compiled tensor operation use the same coordinate map. This name keeps the coordinate description available in the proof API.

Instances For

    Source coordinate read after a sequence of adjacent-axis swaps.

    Instances For

      The coordinate description follows the actual tensor permutation at every rank.

      noncomputable def Proofs.TensorAxis.permuteCLM {s : Spec.Shape} (swaps : List ℕ) :

      Axis permutation on finite coordinate functions, bundled as a continuous linear map.

      This is the pullback x ↦ x ∘ permutedCoordinate s swaps, which is linear for free (LinearMap.funLeft) and continuous because the domain is finite-dimensional.

      Instances For

        The continuous linear map computes the library's tensor permutation.

        Differentiating the actual tensor permutation permutes its input direction.