TorchLean API

NN.Runtime.Autograd.Torch.Core.Ops.Convolution

Eager Tensor Operations #

PyTorch-style tensor operations backed by the eager CPU/CUDA tapes. These wrappers record runtime nodes, dispatch CUDA kernels when requested, and preserve the typed TensorRef surface.

Convolution operations #

def Runtime.Autograd.Torch.Internal.EagerSession.conv {α : Type} (s : EagerSession α) [Context α] [DecidableEq Spec.Shape] {d inC outC : } {kernel stride padding inSpatial : Vector d} {hInC : inC 0} {hKernel : ∀ (i : Fin d), kernel.get i 0} (w : TensorRef α (Spec.Shape.ofList (outC :: inC :: kernel.toList))) (b : TensorRef α (Spec.Shape.dim outC Spec.Shape.scalar)) (x : TensorRef α (Spec.Shape.ofList (inC :: inSpatial.toList))) :
IO (TensorRef α (Spec.Shape.ofList (outC :: (Spec.convOutSpatial inSpatial kernel stride padding).toList)))

N-D convolution for channels-first tensors (inC, spatial...) (no batch axis).

This is the generic counterpart to conv2d. PyTorch comparison: torch.nn.functional.conv{d}d specialized to a single sample.

Instances For
    def Runtime.Autograd.Torch.Internal.EagerSession.conv2d {α : Type} (s : EagerSession α) [Context α] [DecidableRel fun (x1 x2 : α) => x1 > x2] [DecidableEq Spec.Shape] {inC outC kH kW stride padding inH inW : } {h1 : inC 0} {h2 : kH 0} {h3 : kW 0} (kernel : TensorRef α (Spec.Shape.dim outC (Spec.Shape.dim inC (Spec.Shape.dim kH (Spec.Shape.dim kW Spec.Shape.scalar))))) (bias : TensorRef α (Spec.Shape.dim outC Spec.Shape.scalar)) (input : TensorRef α (Spec.Shape.dim inC (Spec.Shape.dim inH (Spec.Shape.dim inW Spec.Shape.scalar)))) :

    2D convolution for channel-first images (C,H,W) (no batch axis). PyTorch: torch.nn.functional.conv2d.

    Instances For
      def Runtime.Autograd.Torch.Internal.EagerSession.convTranspose {α : Type} (s : EagerSession α) [Context α] [DecidableEq Spec.Shape] {d inC outC : } {kernel stride padding inSpatial : Vector d} {hInC : inC 0} {hKernel : ∀ (i : Fin d), kernel.get i 0} (w : TensorRef α (Spec.Shape.ofList (inC :: outC :: kernel.toList))) (b : TensorRef α (Spec.Shape.dim outC Spec.Shape.scalar)) (x : TensorRef α (Spec.Shape.ofList (inC :: inSpatial.toList))) :
      IO (TensorRef α (Spec.Shape.ofList (outC :: (Spec.convTransposeOutSpatial inSpatial kernel stride padding).toList)))

      N-D transpose convolution for channels-first tensors (inC, spatial...) (no batch axis).

      This is the generic counterpart to conv_transpose2d. PyTorch comparison: torch.nn.functional.conv_transpose{d}d specialized to a single sample.

      Instances For
        def Runtime.Autograd.Torch.Internal.EagerSession.convTranspose2d {α : Type} (s : EagerSession α) [Context α] [DecidableEq Spec.Shape] {inC outC kH kW stride padding inH inW : } {h1 : inC 0} {h2 : kH 0} {h3 : kW 0} (kernel : TensorRef α (Spec.Shape.dim inC (Spec.Shape.dim outC (Spec.Shape.dim kH (Spec.Shape.dim kW Spec.Shape.scalar))))) (bias : TensorRef α (Spec.Shape.dim outC Spec.Shape.scalar)) (input : TensorRef α (Spec.Shape.dim inC (Spec.Shape.dim inH (Spec.Shape.dim inW Spec.Shape.scalar)))) :

        2D transpose convolution for channel-first images (C,H,W) (no batch axis). PyTorch: torch.nn.functional.conv_transpose2d.

        Instances For