Skip to content

Commit 55b5a6b

Browse files
surgan12fmassa
authored andcommitted
to_pil_image changes (#762)
1 parent 22bc44e commit 55b5a6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchvision/transforms/functional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def to_pil_image(pic, mode=None):
117117

118118
elif pic.ndimension() == 2:
119119
# if 2D image, add channel dimension (CHW)
120-
pic.unsqueeze_(0)
120+
pic = pic.unsqueeze(0)
121121

122122
elif isinstance(pic, np.ndarray):
123123
if pic.ndim not in {2, 3}:

0 commit comments

Comments
 (0)