Nikronic:

img = img.permute((2, 0, 1)).contiguous()


Thanks for this.  Just for the sake of containment if you want to reverse the order done by ToTensor, it would have to be img = img.permute((1, 2, 0)).contiguous().  The (2, 0, 1) is the forward transformation to go from HWC to CHW.  To undo the operation, the tuple needs to be (1, 2, 0) instead.
Thanks again!