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 compiled backends enter the picture.
N-D convolution for channels-first tensors (inC, spatial...) (no batch axis).
This is the generic counterpart to conv2d; conv2d is implemented as a specialization with
d = 2, scalar stride, and scalar padding.
Instances For
2D convolution for channel-first images (inC,inH,inW) (no batch axis).
PyTorch comparison: torch.nn.functional.conv2d specialized to a single image.
Instances For
N-D transpose convolution for channels-first tensors (inC, spatial...) (no batch axis).
This is the generic counterpart to conv_transpose2d.
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
2D transpose convolution for channel-first images (inC,inH,inW) (no batch axis).
This is implemented as a specialization of conv_transpose with d = 2, scalar stride, and
scalar padding.
Kernel layout matches the spec/PyTorch convention (inC,outC,kH,kW).
PyTorch comparison: torch.nn.functional.conv_transpose2d specialized to a single image.
Instances For
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
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
N-D smooth max pooling (log-sum-exp surrogate) for channels-first tensors (C, spatial...).
Instances For
2D max-pooling for channel-first images (no batch axis).
PyTorch comparison: torch.nn.functional.max_pool2d.
Instances For
2D max-pooling with padding for channel-first images (no batch axis).
PyTorch comparison: max_pool2d(..., padding=...).
Instances For
Smooth approximation of max-pooling (softmax pooling).
This is not a standard PyTorch primitive; it is useful for differentiable relaxations.
Instances For
2D average-pooling for channel-first images (no batch axis).
PyTorch comparison: torch.nn.functional.avg_pool2d.
Instances For
2D average-pooling with padding for channel-first images (no batch axis).
PyTorch comparison: avg_pool2d(..., padding=...).