How to place permute function into the dataloader?

Hello, i have dataloader and permute function given below. I need to get rid of this error :
Given groups=1, weight of size [64, 1, 3, 3], expected input[1, 18, 368, 368] to have 1 channels, but got 18 channels instead
For this reason i need to place permute function into the getitem but when i try to place to into the getitem it didn’t work so can you help me ? What can I do ?

class CustomDataset(Dataset): 
  def __init__(self, image_paths, target_paths, transform, train=True): # initial logic happens like transform
      #self.image_paths = image_paths
      self.target_paths = target_paths 
      self.transforms = transforms.ToTensor()

  def __getitem__(self, index):
      #image =[index])
      mask = np.load(self.target_paths[index])
      t_image = self.transforms(mask)
      return t_image
  def __len__(self): # return count of sample we have 
      return len(self.target_paths)
a=torch.randn(18, 1, 368, 368)
b=a.permute(1, 0, 2, 3)

Based on the input shape I assume you are using a batch_size of 1 and the input tensor has 18 channels.
You could add the permute operation after loading the batch, but note that the channels would now be treated as separate samples since they are in the batch dimension.
Also, the permutation would move the batch dimension to the channel dimension. Increasing the batch size would also increase the number of channels.
Could you explain your use case a bit more, as this sounds rather wrong?