Skip to content

Commit 39f6abe

Browse files
authored
Fix interpolate when no scale_factor is passed (#1785)
1 parent 5ac5ab9 commit 39f6abe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torchvision/ops/misc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def _check_size_scale_factor(dim, size, scale_factor):
7777
raise ValueError("either size or scale_factor should be defined")
7878
if size is not None and scale_factor is not None:
7979
raise ValueError("only one of size or scale_factor should be defined")
80-
if not (scale_factor is not None and len(scale_factor) != dim):
80+
if scale_factor is not None and isinstance(scale_factor, tuple)\
81+
and len(scale_factor) != dim:
8182
raise ValueError(
8283
"scale_factor shape must match input shape. "
8384
"Input is {}D, scale_factor size is {}".format(dim, len(scale_factor))

0 commit comments

Comments
 (0)