I think it makes sense to just save the tensor as image without modifying it. But looks like it modifies it.
Thanks for opening the issue!
This seems like a corner case in make_grid which doesn't return a copy, but a view.
I think a solution would be to make a clone in https://github.com/pytorch/vision/blob/6c7189fcada6f95ab615e08838b1d7fdb148c268/torchvision/utils.py#L69-L70
or, more simply, replace the first mul_ in
https://github.com/pytorch/vision/blob/6c7189fcada6f95ab615e08838b1d7fdb148c268/torchvision/utils.py#L103
with mul.
Most helpful comment
Thanks for opening the issue!
This seems like a corner case in
make_gridwhich doesn't return a copy, but a view.I think a solution would be to make a clone in https://github.com/pytorch/vision/blob/6c7189fcada6f95ab615e08838b1d7fdb148c268/torchvision/utils.py#L69-L70
or, more simply, replace the first
mul_inhttps://github.com/pytorch/vision/blob/6c7189fcada6f95ab615e08838b1d7fdb148c268/torchvision/utils.py#L103
with
mul.