GraphM Convolution Ops #
N-dimensional and two-dimensional convolution and transposed-convolution builders.
N-dimensional convolution (channels-first) on a single sample tensor.
The input shape is (inC, spatial...), the kernel shape is (outC, inC, kernelSpatial...), and the
bias shape is (outC). The output spatial sizes use the PyTorch-style floor-division formula.
The JVP follows bilinearity:
d(conv(k,b,x)) = conv(k,0,dx) + conv(dk,db,x).
Instances For
N-D transpose convolution (channels-first) on a single sample tensor (no batch axis).
Conventions:
- input shape is
(inC, spatial...), - kernel shape is
(inC, outC, kernelSpatial...)(PyTorch layout), - bias shape is
(outC), - output spatial sizes use:
out[a] = (in[a] - 1) * stride[a] - 2*padding[a] + kernel[a](withoutput_padding = 0).
PyTorch comparison: torch.nn.functional.conv_transpose{d}d, specialized to a single sample.
Forward-mode JVP uses bilinearity:
d(convTranspose(k,b,x)) = convTranspose(k,0,dx) + convTranspose(dk,db,x).
Instances For
2D convolution (channel-first) on a single image tensor.
PyTorch comparison: torch.nn.functional.conv2d (without a batch dimension).
Forward-mode JVP uses bilinearity:
d(conv2d(k,b,x)) = conv2d(k,0,dx) + conv2d(dk,db,x).
Instances For
2D transpose convolution (channel-first) on a single image tensor.
PyTorch comparison: torch.nn.functional.conv_transpose2d (without a batch dimension).
Forward-mode JVP uses bilinearity:
d(convTranspose2d(k,b,x)) = convTranspose2d(k,0,dx) + convTranspose2d(dk,db,x).