Skip to content

Commit e3941af

Browse files
authored
Remove unnecessary ignore directives to fix mypy (#6713)
1 parent d020820 commit e3941af

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

torchvision/prototype/features/_feature.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def __new__(
3232
return (
3333
torch.as_tensor( # type: ignore[return-value]
3434
data,
35-
dtype=dtype, # type: ignore[arg-type]
36-
device=device, # type: ignore[arg-type]
35+
dtype=dtype,
36+
device=device,
3737
)
38-
.as_subclass(cls) # type: ignore[arg-type]
38+
.as_subclass(cls)
3939
.requires_grad_(requires_grad)
4040
)
4141

@@ -115,7 +115,7 @@ def __torch_function__(
115115
# Inplace `func`'s, canonically identified with a trailing underscore in their name like `.add_(...)`,
116116
# will retain the input type. Thus, we need to unwrap here.
117117
if isinstance(output, cls):
118-
return output.as_subclass(torch.Tensor) # type: ignore[arg-type]
118+
return output.as_subclass(torch.Tensor)
119119

120120
return output
121121

torchvision/prototype/features/_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __new__(
7171
device: Optional[Union[torch.device, str, int]] = None,
7272
requires_grad: bool = False,
7373
) -> Image:
74-
data = torch.as_tensor(data, dtype=dtype, device=device) # type: ignore[arg-type]
74+
data = torch.as_tensor(data, dtype=dtype, device=device)
7575
if data.ndim < 2:
7676
raise ValueError
7777
elif data.ndim == 2:

torchvision/prototype/transforms/functional/_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def normalize(
1616
correct_type = isinstance(inpt, torch.Tensor)
1717
else:
1818
correct_type = features.is_simple_tensor(inpt) or isinstance(inpt, features.Image)
19-
inpt = inpt.as_subclass(torch.Tensor) # type: ignore[arg-type]
19+
inpt = inpt.as_subclass(torch.Tensor)
2020
if not correct_type:
2121
raise TypeError(f"img should be Tensor Image. Got {type(inpt)}")
2222

0 commit comments

Comments
 (0)