TorchLean API

NN.Runtime.Autograd.Torch.Core.Ops.Indexing

Eager Tensor Operations #

PyTorch-style tensor operations recorded on the session's tape. Each one runs the CPU or the CUDA kernel of the operation, as the session's device selects, and preserves the typed TensorRef surface.

Indexing operations #

def Runtime.Autograd.Torch.Internal.EagerSession.select {α : Type} [TorchLean.Storage α] (session : EagerSession α) [Zero α] {shape : Spec.Shape} (axis : ℕ) [Spec.Shape.AxisInBounds axis shape] (x : TensorRef α shape) (index : Fin (shape.axisSize axis)) :
IO (TensorRef α (shape.eraseAxis axis))

Select one bounded coordinate from an arbitrary tensor axis.

Instances For
    def Runtime.Autograd.Torch.Internal.EagerSession.indexSelect {α : Type} [TorchLean.Storage α] (session : EagerSession α) [Add α] [Zero α] {shape : Spec.Shape} (axis count : ℕ) [Spec.Shape.AxisInBounds axis shape] (x : TensorRef α shape) (indices : TorchLean.Tensor (Fin (shape.axisSize axis)) [count]) :
    IO (TensorRef α (shape.replaceAxis axis count))

    Select several bounded coordinates from an arbitrary tensor axis.

    Instances For
      def Runtime.Autograd.Torch.Internal.EagerSession.scatterAdd {α : Type} [TorchLean.Storage α] (session : EagerSession α) [Add α] [Zero α] {shape : Spec.Shape} (axis count : ℕ) [Spec.Shape.AxisInBounds axis shape] (base : TensorRef α shape) (source : TensorRef α (shape.replaceAxis axis count)) (indices : TorchLean.Tensor (Fin (shape.axisSize axis)) [count]) :
      IO (TensorRef α shape)

      Add source slices into an arbitrary tensor axis at bounded coordinates.

      Instances For