Skip to content

Commit

Permalink
fix len error (#1981)
Browse files Browse the repository at this point in the history
Co-authored-by: eellison <eellison@fb.com>
  • Loading branch information
eellison and eellison authored Mar 16, 2020
1 parent 7c077f6 commit 2875315
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions torchvision/ops/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ def _check_size_scale_factor(dim, size, scale_factor):
raise ValueError("either size or scale_factor should be defined")
if size is not None and scale_factor is not None:
raise ValueError("only one of size or scale_factor should be defined")
if scale_factor is not None and isinstance(scale_factor, tuple)\
and len(scale_factor) != dim:
raise ValueError(
"scale_factor shape must match input shape. "
"Input is {}D, scale_factor size is {}".format(dim, len(scale_factor))
)
if scale_factor is not None:
if isinstance(scale_factor, (list, tuple)):
if len(scale_factor) != dim:
raise ValueError(
"scale_factor shape must match input shape. "
"Input is {}D, scale_factor size is {}".format(dim, len(scale_factor))
)


def _output_size(dim, input, size, scale_factor):
Expand Down

0 comments on commit 2875315

Please sign in to comment.