Skip to content

Commit c5e9a10

Browse files
authored
add error for max_size with size sequence in resize (#7253)
1 parent 0e0a5dc commit c5e9a10

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

torchvision/prototype/transforms/functional/_geometry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ def _compute_resized_output_size(
148148
) -> List[int]:
149149
if isinstance(size, int):
150150
size = [size]
151+
elif max_size is not None and len(size) != 1:
152+
raise ValueError(
153+
"max_size should only be passed if size specifies the length of the smaller edge, "
154+
"i.e. size should be an int or a sequence of length 1 in torchscript mode."
155+
)
151156
return __compute_resized_output_size(spatial_size, size=size, max_size=max_size)
152157

153158

0 commit comments

Comments
 (0)