Change Image format from NHWC to NCHW for Pytorch
In pytorch we need images in NCHW format but my images are NHWC.

What is the procedure to feed this image to CNN? (I have found this solution which suggests to use "permute" but where and how should i use it?)

Using torch.Tensor.permute():

 x = x.permute(0, 3, 1, 2) # from NHWC to NCHW

