Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Aug 30, 2023
1 parent 6e54234 commit ae31288
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions torchvision/transforms/v2/_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,8 @@ def __init__(
fill: Union[_FillType, Dict[Union[Type, str], _FillType]] = 0,
) -> None:
super().__init__()
self.alpha = _setup_number_or_seq(alpha, "alpha", 2)
self.sigma = _setup_number_or_seq(sigma, "sigma", 2)
self.alpha = _setup_number_or_seq(alpha, "alpha")
self.sigma = _setup_number_or_seq(sigma, "sigma")

self.interpolation = _check_interpolation(interpolation)
self.fill = fill
Expand Down
2 changes: 1 addition & 1 deletion torchvision/transforms/v2/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def __init__(
if ks <= 0 or ks % 2 == 0:
raise ValueError("Kernel size value should be an odd and positive number.")

self.sigma = _setup_number_or_seq(sigma, "sigma", 2)
self.sigma = _setup_number_or_seq(sigma, "sigma")

if not 0.0 < self.sigma[0] <= self.sigma[1]:
raise ValueError(f"sigma values should be positive and of the form (min, max). Got {self.sigma}")
Expand Down
4 changes: 2 additions & 2 deletions torchvision/transforms/v2/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def _setup_number_or_seq(arg: Union[int, float, Sequence[Union[int, float]]], name: str) -> Sequence[float]:
if not isinstance(arg, (int, float, Sequence)):
raise TypeError(f"{name} should be a number or a sequence of numbers. Got {type(arg)}")
if isinstance(arg, Sequence) and len(arg) not in (1, req_size):
if isinstance(arg, Sequence) and len(arg) not in (1, 2):
raise ValueError(f"If {name} is a sequence its length should be 1 or 2. Got {len(arg)}")
if isinstance(arg, Sequence):
for element in arg:
Expand All @@ -30,7 +30,7 @@ def _setup_number_or_seq(arg: Union[int, float, Sequence[Union[int, float]]], na

if isinstance(arg, (int, float)):
arg = [float(arg), float(arg)]
if isinstance(arg, Sequence):
elif isinstance(arg, Sequence):
if len(arg) == 1:
arg = [float(arg[0]), float(arg[0])]
else:
Expand Down

0 comments on commit ae31288

Please sign in to comment.