title: Change dimensions of image when creating custom dataloader in pytorch
body: <p>I was training my CNN on the CIFAR10 dataset. I extracted the 50,000 images of dimensions (32 x 32 x 3) and read them in a list. I converted them into numpy arrays and stored them in a list.  I did the same with the labels for my training and testing.</p>
  
  <p>I then constructed my CNN of two layers and a single FC in pytorch. Before doing this I created my own custom data loader. While doing so, the dimensions of the image that I am feeding in it are changing. The dimensions (32 x 32 x 3) are changing to (3 x 32 x 32) and I am not being able to train my neural network.</p>
  
  <pre><code>tensor_x = torch.stack([torch.Tensor(i) for i in train_images])
  tensor_y = torch.stack([torch.Tensor(i) for i in train_labels])
  dataset = data_utils.TensorDataset(tensor_x , tensor_y)
  train_dataloader = data_utils.DataLoader(dataset=dataset)
  
  tensor_x = torch.stack([torch.Tensor(i) for i in test_images])
  tensor_y = torch.stack([torch.Tensor(i) for i in test_labels])
  dataset = data_utils.TensorDataset(tensor_x , tensor_y)
  test_dataloader = data_utils.DataLoader(dataset=dataset)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/b70oj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b70oj.png" alt="enter image description here"></a></p>
  
  <pre><code>RuntimeError: Given groups=1, weight[64, 3, 3, 3], so expected input[1, 32, 32, 3] to have 3 channels, but got 32 channels instead
  </code></pre>