-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Description
Reported in forum: topic by Shisho_Sama.
Reason:
save_image
manipulates the input tensor inplace in this line of code.
Code snippet to reproduce:
x = torch.randn(10, 1, 100, 100)
grid = torchvision.utils.make_grid(x)
print(grid.min(), grid.max(), grid.mean())
> tensor(-4.4464) tensor(4.4604) tensor(-0.0003)
torchvision.utils.save_image(grid, 'tmp.png')
print(grid.min(), grid.max(), grid.mean())
> tensor(0.) tensor(255.) tensor(48.1135)
Working on a copy would solve this issue.
Let me know, if you would be interested in a quick fix adding a clone()
to the mentioned line of code or if another approach would be preferable.
Coderx7
Metadata
Metadata
Assignees
Labels
No labels