Commit 429dbebe authored by Edgar Simo-Serra's avatar Edgar Simo-Serra Committed by Soumith Chintala
Browse files

Fixed save_image to correctly output values in the full byte range. (#41)

parent c76de96a
......@@ -50,6 +50,6 @@ def save_image(tensor, filename, nrow=8, padding=2):
from PIL import Image
tensor = tensor.cpu()
grid = make_grid(tensor, nrow=nrow, padding=padding)
ndarr = grid.mul(0.5).add(0.5).mul(255).byte().transpose(0, 2).transpose(0, 1).numpy()
ndarr = grid.mul(255).byte().transpose(0,2).transpose(0,1).numpy()
im = Image.fromarray(ndarr)
im.save(filename)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment