Torchvision.utils make_grid does not normalize


(Utku Evci) #1

Hi,

I’m having trouble with make_grid not normalizing the input. Am I doing something wrong? Or is this behaviour expected?

Best

import torch
import torchvision
from torchvision.utils import make_grid

print(torchvision.__file__) ##.../anaconda3/lib/python3.6/site-packages/torchvision-0.2.0-
print(torch.__version__) ## 0.3.0.post4

a=(torch.rand(4,5)-0.5).unsqueeze(0)
print(a.min()) ##-0.4951971769332886
gr = make_grid(a,normalize=True, scale_each=True,nrow=4,padding=2)
print(gr.min()) ##-0.4951971769332886

(Alykhan Tejani) #2

This has been fixed in master. See here for more details: https://github.com/pytorch/vision/issues/404