"vscode:/vscode.git/clone" did not exist on "e1bdcc7af38ff9d1d8fbdc223aa7b306b19bfdff"
Unverified Commit 3feb5021 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

remove redundant typing casts (#8140)

parent c1e2095c
...@@ -48,7 +48,7 @@ class Label(_LabelBase): ...@@ -48,7 +48,7 @@ class Label(_LabelBase):
if self.categories is None: if self.categories is None:
raise RuntimeError("Label does not have categories") raise RuntimeError("Label does not have categories")
return tree_map(lambda idx: self.categories[idx], self.tolist()) return tree_map(lambda idx: self.categories[idx], self.tolist()) # type: ignore[index]
class OneHotLabel(_LabelBase): class OneHotLabel(_LabelBase):
......
import math import math
import numbers import numbers
import warnings import warnings
from typing import Any, Callable, cast, Dict, List, Literal, Optional, Sequence, Tuple, Type, Union from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple, Type, Union
import PIL.Image import PIL.Image
import torch import torch
...@@ -241,10 +241,8 @@ class RandomResizedCrop(Transform): ...@@ -241,10 +241,8 @@ class RandomResizedCrop(Transform):
if not isinstance(scale, Sequence): if not isinstance(scale, Sequence):
raise TypeError("Scale should be a sequence") raise TypeError("Scale should be a sequence")
scale = cast(Tuple[float, float], scale)
if not isinstance(ratio, Sequence): if not isinstance(ratio, Sequence):
raise TypeError("Ratio should be a sequence") raise TypeError("Ratio should be a sequence")
ratio = cast(Tuple[float, float], ratio)
if (scale[0] > scale[1]) or (ratio[0] > ratio[1]): if (scale[0] > scale[1]) or (ratio[0] > ratio[1]):
warnings.warn("Scale and ratio should be of kind (min, max)") warnings.warn("Scale and ratio should be of kind (min, max)")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment