Obtaining Toeplitz matrix for convolution

In this issue @ezyang references an implementation of convolutions that uses the Toeplitz matrix.

I have a state_dict (and also a nn.Module class) from a network and explicitly need these Toeplitz matrices for further calculations but I admittedly have not a strong grasp on the things going on in ATen and how I could use that directly in Python. Is there a way to do this?

Hi McLawrence,
Please refer to the nn.Unfold module. This would enable you to generate the toeplitz matrices(column matrix).
Hope this helps!

1 Like

@Mazhar_Shaikh Using unfold, I can create a matrix from the input and do a matrix multiplication with the kernel vector.
However, what I need would be a matrix from the kernel, not the input. Which seems not possible with unfold (as the kernel is smaller than the input). Do you know of an alternative?

4 Likes