TorchLean API

NN.Runtime.Autograd.Engine.LibTorch.Ops.Indexing

CUDA Tape Operations: Concatenation, Slicing, and Indexing #

Concat / slice along dim 0 #

@[inline]

Concatenate along the leading dimension, preserving the common trailing shape.

Instances For
    @[inline]
    def Runtime.Autograd.LibTorch.Tape.slice {n : ℕ} {s : Spec.Shape} (t : Tape SomeBuffer) (xId start len : ℕ) (_h : start + len ≤ n) :

    Slice along the leading dimension: x[start:start+len].

    Instances For

      Arbitrary-axis bounded indexing #

      @[reducible, inline]

      An adjacent-swap depth paired with its checked CUDA representation.

      Instances For

        Adjacent swaps that move axis to the outermost position.

        Instances For

          Check each adjacent-swap depth before it crosses the CUDA ABI.

          Instances For

            Apply swaps to an owned buffer, releasing each consumed intermediate.

            Instances For

              Apply swaps to a borrowed buffer, owning only the buffers created by the swaps.

              Instances For

                Release a permuted buffer exactly when permuteBorrowed allocated it.

                Instances For

                  Convert bounded tensor indices to the host array expected by CUDA row kernels.

                  Instances For
                    @[inline]

                    Select one bounded coordinate from any tensor axis.

                    Instances For
                      @[inline]

                      Select several bounded coordinates from any tensor axis.

                      Instances For
                        @[inline]
                        def Runtime.Autograd.LibTorch.Tape.scatterAdd {s : Spec.Shape} (t : Tape SomeBuffer) (baseId sourceId axis count : ℕ) [Spec.Shape.AxisInBounds axis s] (indices : TorchLean.Tensor (Fin (s.axisSize axis)) [count]) :

                        Add indexed source slices into any tensor axis.

                        Instances For