Skip to content

Commit d147464

Browse files
committed
Extended the tescase for transforms.RandomCrop
1 parent 9c5c211 commit d147464

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test_transforms.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ def test_random_crop(self):
205205
assert result.size(2) == width
206206
assert np.allclose(img.numpy(), result.numpy())
207207

208+
lheight = height + 5
209+
lwidth = width + 5
210+
result = transforms.Compose([
211+
transforms.ToPILImage(),
212+
transforms.RandomCrop((lheight, lwidth), pad_if_needed=True),
213+
transforms.ToTensor(),
214+
])(img)
215+
assert result.size(1) == lheight
216+
assert result.size(2) == lwidth
217+
208218
def test_pad(self):
209219
height = random.randint(10, 32) * 2
210220
width = random.randint(10, 32) * 2

0 commit comments

Comments
 (0)