Learn · 5
Convolution
Images are NCHW — batch, channels, height, width, the same layout as
torch. The sister binding used NHWC to work around a TF.js limit; the kernels here
have no such limit, so the layout is not inherited.
One convolution
nn.Conv2d(inC, outC, kernel, stride, padding). Shapes follow the
usual formula, and the quickest way to be sure is to print them.
A small classifier
Convolution, activation, pooling, twice — then flatten and a linear head. This is the shape of every first CNN, and it trains here in a couple of hundred milliseconds.
What the GPU actually did
The device counts what it was asked to do. These numbers do not depend on the adapter — they are decided by the code path, which is why the repository's cost test can run where a wall-clock benchmark cannot.