I assume m0 contains the flattened conv filter weights?
If so, the function might work, but I would need to see the shapes to be sure.
Could you post a minimal code snippet to run your code?
I.e. a dummy conv layer you would like to copy to the linear layer?