How to reshape tensor?

My input is [batchsize, 32, 32, 3], but the correct input is [batchsize, 3, 32, 32]
How to reshape [batchsize, 32, 32, 3] to [batchsize, 3, 32, 32]?
Thanks for your help!

You could use .permute(0, 3, 1, 2) to achieve that.
If you encounter an error using this tensor in your model, you might have to call .contiguous() on it.

Thanks for your help