Unfold kernel instead of input

Hi. I am currently working on a project for which I need to treat convolution operation as matrix multiplication, but with the input image flattened and the kernel unfolded . Is there any way I can achieve this using nn.Unfold?

Thanks in regard.