diff --git a/torchvision/prototype/tv_tensors/_label.py b/torchvision/prototype/tv_tensors/_label.py index 506c4fb2b0e..23b6142c33d 100644 --- a/torchvision/prototype/tv_tensors/_label.py +++ b/torchvision/prototype/tv_tensors/_label.py @@ -48,7 +48,7 @@ def to_categories(self) -> Any: if self.categories is None: 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): diff --git a/torchvision/transforms/v2/_geometry.py b/torchvision/transforms/v2/_geometry.py index e4ba3d9824b..c670ca5e523 100644 --- a/torchvision/transforms/v2/_geometry.py +++ b/torchvision/transforms/v2/_geometry.py @@ -1,7 +1,7 @@ import math import numbers 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 torch @@ -241,10 +241,8 @@ def __init__( if not isinstance(scale, Sequence): raise TypeError("Scale should be a sequence") - scale = cast(Tuple[float, float], scale) if not isinstance(ratio, Sequence): raise TypeError("Ratio should be a sequence") - ratio = cast(Tuple[float, float], ratio) if (scale[0] > scale[1]) or (ratio[0] > ratio[1]): warnings.warn("Scale and ratio should be of kind (min, max)")