Skip to content

Commit 3feb502

Browse files
authored
remove redundant typing casts (#8140)
1 parent c1e2095 commit 3feb502

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

torchvision/prototype/tv_tensors/_label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def to_categories(self) -> Any:
4848
if self.categories is None:
4949
raise RuntimeError("Label does not have categories")
5050

51-
return tree_map(lambda idx: self.categories[idx], self.tolist())
51+
return tree_map(lambda idx: self.categories[idx], self.tolist()) # type: ignore[index]
5252

5353

5454
class OneHotLabel(_LabelBase):

torchvision/transforms/v2/_geometry.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import math
22
import numbers
33
import warnings
4-
from typing import Any, Callable, cast, Dict, List, Literal, Optional, Sequence, Tuple, Type, Union
4+
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple, Type, Union
55

66
import PIL.Image
77
import torch
@@ -241,10 +241,8 @@ def __init__(
241241

242242
if not isinstance(scale, Sequence):
243243
raise TypeError("Scale should be a sequence")
244-
scale = cast(Tuple[float, float], scale)
245244
if not isinstance(ratio, Sequence):
246245
raise TypeError("Ratio should be a sequence")
247-
ratio = cast(Tuple[float, float], ratio)
248246
if (scale[0] > scale[1]) or (ratio[0] > ratio[1]):
249247
warnings.warn("Scale and ratio should be of kind (min, max)")
250248

0 commit comments

Comments
 (0)