Pytroch's Cifar10 images as input to ResNet18

I would like to train a ResNet18(Pretrained=False) with Cifar10. Now, each input tensor that belongs to Cifar10 has orders (Height, Width, Channels). Is it necessary to permute the order and then feed images to ResNet18? does a ResNet18 model which is not pretrained limited to inputs with tensor order such as (Batch, Channels, Height, Width)?

It does not matter which net you want to train, you have to be aware of your convolutions. I mean if your net uses nn.conv2d, then the input should be like (N, C, W, H), which N is your batch size.
BTW you need to prepare a dataloder before loading the data to your net.

1 Like

thank you for your answer. I noticed that when using ToTensor() in the dataloader transformations, we get the order [N,C,H,W]. In this case we don’t need to use permute().

Nope. As long as the input is in the order [N,C,H,W] you can go ahead and it should work fine.