core/nn/conv2d library

2D convolution — inference-only, im2col + matmul.

Takes NCHW input [N, Cin, H, W] and produces [N, Cout, Hout, Wout] where Hout = (H + 2*pad - Kh) / stride + 1 and analogously for Wout.

The forward pass unfolds every output position into a Cin * Kh * Kw column and stacks all such columns row-wise to get a [N*Hout*Wout, Cin*Kh*Kw] matrix. That is multiplied by the pre-transposed weight [Cin*Kh*Kw, Cout] and reshaped back to NCHW. The result stays connected to the autograd tape through the underlying matmul, but Conv2d weights are meant to be loaded from pretrained checkpoints (e.g. LC0), not trained in this repo.

Classes

Conv2d