I don’t think that putting it in Dataset will change anything since batch construction is the task of DataLoader, so your i1.shape (specifically 100), comes directly form it . Moreover PyTorch normal format is NCHW, (the batch dimension is in the 0th position, then colour, height and width), so DataLoader will make it that way. I think the easiest way is to transpose it after getting batch from DataLoader. I don’t know if that satisfy you, or you have to explicitly put this in DataLoader. If you have to put it in DataLoader I think you can do it via collate_fn (docs 3), but I don’t have experience with that.