Assuming original inputs are contiguous, tensors will become channels_last automatically after permute call.
inputs, labels = data
inputs = inputs.permute(0,3,1,2)
print("\ninput: ", inputs.shape, inputs.is_contiguous(memory_format=torch.channels_last))