Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def test_scale(self):
owidth = random.randint(5, 12) * 2
result = transforms.Compose([
transforms.ToPILImage(),
transforms.Scale((owidth, oheight)),
transforms.Scale((oheight, owidth)),
transforms.ToTensor(),
])(img)
assert result.size(1) == oheight
assert result.size(2) == owidth

result = transforms.Compose([
transforms.ToPILImage(),
transforms.Scale([owidth, oheight]),
transforms.Scale([oheight, owidth]),
transforms.ToTensor(),
])(img)
assert result.size(1) == oheight
Expand Down
4 changes: 2 additions & 2 deletions torchvision/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Scale(object):

Args:
size (sequence or int): Desired output size. If size is a sequence like
(w, h), output size will be matched to this. If size is an int,
(h, w), output size will be matched to this. If size is an int,
smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be rescaled to
(size * height / width, size)
Expand Down Expand Up @@ -199,7 +199,7 @@ def __call__(self, img):
ow = int(self.size * w / h)
return img.resize((ow, oh), self.interpolation)
else:
return img.resize(self.size, self.interpolation)
return img.resize(self.size[::-1], self.interpolation)


class CenterCrop(object):
Expand Down