CNN training for custom image shapes

For cifar10 or mnist the shape of data is for eg (100, 3, 30, 30) which can be used for training but for custom image dataset the shape is (100, 30, 30 ,3) how can the shape be changed which will be used for training. When I tried the reshape it’s showing an error

Did you try torch.reshape?
Incase if it’s showing an error, what is it?

Yeah it is showing error

What you actually need here is reordering (specific permutation) of dimensions here, not reshaping.
Consider the following:

>> custom_tensor.size()
(100, 30, 30, 3)
>> input_tensor = custom_tensor.permute(0, 3, 1, 2)
>> input_tensor.size()
(100, 3, 30, 30)

Now you can pass it to your Conv2d layers.