TorchLean API

NN.Runtime.Autograd.Engine.Core.ConvPool

Core Tape Convolution and Pooling #

This file implements the pure tape nodes for convolution, transposed convolution, and pooling. These nodes are backend-independent: they record forward values, parents, and backward closures using the spec-layer definitions before CUDA or typed graph execution enters the picture.

def Runtime.Autograd.Tape.conv {α : Type} [TorchLean.Storage α] [Context α] [DecidableRel fun (x1 x2 : α) => x1 > x2] {d inC outC : } {kernel stride padding inSpatial : TorchLean.Tensor [d]} (t : Tape α) (kernelId biasId inputId : ) (name : String := "conv") :

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

The spatial rank and every geometric parameter are encoded by vectors of the same length.

Instances For
    def Runtime.Autograd.Tape.convTranspose {α : Type} [TorchLean.Storage α] [Context α] [DecidableRel fun (x1 x2 : α) => x1 > x2] {d inC outC : } {kernel stride padding inSpatial : TorchLean.Tensor [d]} (t : Tape α) (kernelId biasId inputId : ) (name : String := "conv_transpose") :

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

    Kernel layout matches the spec/PyTorch convention (inC, outC, kernel[0], ..., kernel[d-1]).

    PyTorch comparison: torch.nn.functional.conv_transpose{d}d specialized to a single sample (no batch axis).

    Instances For
      def Runtime.Autograd.Tape.maxPool {α : Type} [TorchLean.Storage α] [Context α] {d C : } {inSpatial kernel stride padding : TorchLean.Tensor [d]} (t : Tape α) (xId : ) :

      N-D max pooling for channels-first tensors (C, spatial...) (no batch axis).

      Padding is symmetric per-axis and uses zeros. To model unpadded pooling, pass padding := 0 on every axis.

      Instances For
        def Runtime.Autograd.Tape.avgPool {α : Type} [TorchLean.Storage α] [Context α] {d C : } {inSpatial kernel stride padding : TorchLean.Tensor [d]} (t : Tape α) (xId : ) :

        N-D average pooling for channels-first tensors (C, spatial...) (no batch axis).

        Padding is symmetric per-axis and uses zeros; pooling uses count_include_pad=true semantics.

        Instances For
          def Runtime.Autograd.Tape.smoothMaxPool {α : Type} [TorchLean.Storage α] [Context α] [DecidableEq α] {d C : } {inSpatial kernel stride padding : TorchLean.Tensor [d]} (t : Tape α) (xId : ) (beta : α) :

          N-D smooth max pooling (log-sum-exp surrogate) for channels-first tensors (C, spatial...).

          The executable tape requires a finite, nonzero beta. Finiteness is checked through the scalar arithmetic contract: finite scalar backends satisfy beta - beta == 0, whereas IEEE NaN and infinity do not. At least one spatial dimension is required, matching the native runtime contract.

          Instances For