TorchLean API

NN.Runtime.Autograd.Engine.Cuda.Ops.Indexing

CUDA Tape Operations: Concatenation, Slicing, and Indexing #

Concat / slice (1D) #

def Runtime.Autograd.Cuda.Tape.concat1d {n m : } (t : Tape) (aId bId : ) :

Concatenate two 1D buffers.

Instances For

    Concatenate two 1D tensors (CPU tape name).

    Instances For
      def Runtime.Autograd.Cuda.Tape.slice1d {n start len : } (t : Tape) (xId : ) :

      Slice len entries from a one-dimensional CUDA buffer starting at start.

      Instances For

        Concat / slice along dim 0 #

        Concatenate along dim 0 for tensors with leading dimension (CPU tape name).

        Instances For
          def Runtime.Autograd.Cuda.Tape.sliceRange0 {n : } {s : Spec.Shape} (t : Tape) (xId start len : ) (_h : len + start n) :

          Slice along dim 0: x[start:start+len] (CPU tape name).

          Instances For

            Gather / scatter (host Nat indices) #

            Indices are non-differentiable and remain on the host. Kernels totalize out-of-bounds indices as documented in NN.Runtime.Autograd.Engine.Cuda.Kernels.

            Gather a scalar from a 1D vector using a compile-time index.

            Instances For
              def Runtime.Autograd.Cuda.Tape.gatherRow {rows cols : } (t : Tape) (xId : ) (i : Fin rows) :

              Gather a row from a 2D matrix using a compile-time index.

              Instances For

                Gather a scalar from a 1D vector using a runtime Nat index (totalized by the kernel).

                Instances For

                  Convert a length-k natural-number tensor into the index array expected by CUDA gather/scatter kernels.

                  Instances For

                    Gather k scalars from a length-n vector.

                    Instances For

                      Gather k rows from a (rows, cols) matrix (row-major).

                      Instances For
                        def Runtime.Autograd.Cuda.Tape.scatterAddVec {n : } (t : Tape) (xId vId : ) (i : Fin n) :

                        Scatter-add into a vector: out = x with out[i] += v.

                        Instances For
                          def Runtime.Autograd.Cuda.Tape.scatterAddRow {rows cols : } (t : Tape) (xId vId : ) (i : Fin rows) :

                          Scatter-add into a matrix row: out = x with out[i,:] += v.

                          Instances For