PyTorch uses the channels-first memory layout by default, so make sure your data is loaded in the shape [batch_size, channels, height, width]. Based on the print statement it seems the channel dimension is the last dim.