Basically the inverse of transforms.Normalize as this will allow us to visualize tensors during training more easily.
I agree with @karandwivedi42 and the comment that he linked to.
If you want to reverse the normalization, all you need to do is to use a new normalization, with slight modifications:
mean = torch.tensor([1, 2, 3], dtype=torch.float32)
std = torch.tensor([2, 2, 2], dtype=torch.float32)
normalize = T.Normalize(mean.tolist(), std.tolist())
unnormalize = T.Normalize((-mean / std).tolist(), (1.0 / std).tolist())
EDIT: fixed thanks to @karandwivedi42 comment
Thanks @karandwivedi42 , my bad!
I'll fix my comment!
Most helpful comment
I agree with @karandwivedi42 and the comment that he linked to.
If you want to reverse the normalization, all you need to do is to use a new normalization, with slight modifications:
EDIT: fixed thanks to @karandwivedi42 comment