# 2d convolution: What is the difference between convolution using blocked Toeplitz matrix and convolution layers?

For a given matrices $$A$$ of size $$4\times 4$$ and $$B$$ of size $$3\times 3$$ then I construct a blocked Toeplitz matrix and perform the convolution. The resulting output is of size $$6 \times 6$$. I have no doubt in setting up the blocked Toeplitz matrix and perform the convolution.

But in Neural networks the convolution of a $$4 \times 4$$ matrix with the so called kernel of size $$3 \times 3$$ results in $$2 \times 2$$ matrix. Presumably without zero-padding and stride of one.

I have no problem in understanding the results but the difference in output size is something I do not understand.

## 1 Answer

The former is calculating a full sized convolution resulting in an N + M - 1 size, while the later is probably calculating a "valid" sized convolution. This case only returns the values from the convolution where there is complete overlap between the matrices, resulting in an N - M + 1 size. See MATLAB's documentation on the conv function (specifically the shape parameter) for more.