Skip to content

Commit 4d7f70b

Browse files
committed
scale change to (h, w) ordering. (based on pytorch#256)
1 parent 538d87b commit 4d7f70b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

torchvision/transforms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def scale(img, size, interpolation=Image.BILINEAR):
144144
Args:
145145
img (PIL.Image): Image to be scaled.
146146
size (sequence or int): Desired output size. If size is a sequence like
147-
(w, h), output size will be matched to this. If size is an int,
147+
(h, w), output size will be matched to this. If size is an int,
148148
smaller edge of the image will be matched to this number.
149149
i.e, if height > width, then image will be rescaled to
150150
(size * height / width, size)
@@ -172,7 +172,7 @@ def scale(img, size, interpolation=Image.BILINEAR):
172172
ow = int(size * w / h)
173173
return img.resize((ow, oh), interpolation)
174174
else:
175-
return img.resize(size, interpolation)
175+
return img.resize(size[::-1], interpolation)
176176

177177

178178
def pad(img, padding, fill=0):
@@ -355,7 +355,7 @@ class Scale(object):
355355
356356
Args:
357357
size (sequence or int): Desired output size. If size is a sequence like
358-
(w, h), output size will be matched to this. If size is an int,
358+
(h, w), output size will be matched to this. If size is an int,
359359
smaller edge of the image will be matched to this number.
360360
i.e, if height > width, then image will be rescaled to
361361
(size * height / width, size)

0 commit comments

Comments
 (0)