I’m not sure what your actual use case is, but if you are trying to implement a convolution “manually” via a matrix multiplication, take a look at nn.Unfold 3, which gives an example of a conv in the docs.