How to apply torchvision transform to a single tensor

Hi there,

Is there a clean way to apply torchvision transform to a single tensor (shape [3, 224, 224], has normalized to [0, 1]).

Thanks!

I guess you dont want to use all these values then?
transform = transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
normalized = transform(original)

If you just want in [0,1] why not just divide by 255? Not a bad idea.

1 Like