Skip to content

Commit 429dbeb

Browse files
bobbenssoumith
authored andcommitted
Fixed save_image to correctly output values in the full byte range. (#41)
1 parent c76de96 commit 429dbeb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchvision/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ def save_image(tensor, filename, nrow=8, padding=2):
5050
from PIL import Image
5151
tensor = tensor.cpu()
5252
grid = make_grid(tensor, nrow=nrow, padding=padding)
53-
ndarr = grid.mul(0.5).add(0.5).mul(255).byte().transpose(0, 2).transpose(0, 1).numpy()
53+
ndarr = grid.mul(255).byte().transpose(0,2).transpose(0,1).numpy()
5454
im = Image.fromarray(ndarr)
5555
im.save(filename)

0 commit comments

Comments
 (0)