Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
e3941afc
Unverified
Commit
e3941afc
authored
Oct 06, 2022
by
Vasilis Vryniotis
Committed by
GitHub
Oct 06, 2022
Browse files
Remove unnecessary `ignore` directives to fix mypy (#6713)
parent
d020820e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
torchvision/prototype/features/_feature.py
torchvision/prototype/features/_feature.py
+4
-4
torchvision/prototype/features/_image.py
torchvision/prototype/features/_image.py
+1
-1
torchvision/prototype/transforms/functional/_misc.py
torchvision/prototype/transforms/functional/_misc.py
+1
-1
No files found.
torchvision/prototype/features/_feature.py
View file @
e3941afc
...
...
@@ -32,10 +32,10 @@ class _Feature(torch.Tensor):
return
(
torch
.
as_tensor
(
# type: ignore[return-value]
data
,
dtype
=
dtype
,
# type: ignore[arg-type]
device
=
device
,
# type: ignore[arg-type]
dtype
=
dtype
,
device
=
device
,
)
.
as_subclass
(
cls
)
# type: ignore[arg-type]
.
as_subclass
(
cls
)
.
requires_grad_
(
requires_grad
)
)
...
...
@@ -115,7 +115,7 @@ class _Feature(torch.Tensor):
# Inplace `func`'s, canonically identified with a trailing underscore in their name like `.add_(...)`,
# will retain the input type. Thus, we need to unwrap here.
if
isinstance
(
output
,
cls
):
return
output
.
as_subclass
(
torch
.
Tensor
)
# type: ignore[arg-type]
return
output
.
as_subclass
(
torch
.
Tensor
)
return
output
...
...
torchvision/prototype/features/_image.py
View file @
e3941afc
...
...
@@ -71,7 +71,7 @@ class Image(_Feature):
device
:
Optional
[
Union
[
torch
.
device
,
str
,
int
]]
=
None
,
requires_grad
:
bool
=
False
,
)
->
Image
:
data
=
torch
.
as_tensor
(
data
,
dtype
=
dtype
,
device
=
device
)
# type: ignore[arg-type]
data
=
torch
.
as_tensor
(
data
,
dtype
=
dtype
,
device
=
device
)
if
data
.
ndim
<
2
:
raise
ValueError
elif
data
.
ndim
==
2
:
...
...
torchvision/prototype/transforms/functional/_misc.py
View file @
e3941afc
...
...
@@ -16,7 +16,7 @@ def normalize(
correct_type
=
isinstance
(
inpt
,
torch
.
Tensor
)
else
:
correct_type
=
features
.
is_simple_tensor
(
inpt
)
or
isinstance
(
inpt
,
features
.
Image
)
inpt
=
inpt
.
as_subclass
(
torch
.
Tensor
)
# type: ignore[arg-type]
inpt
=
inpt
.
as_subclass
(
torch
.
Tensor
)
if
not
correct_type
:
raise
TypeError
(
f
"img should be Tensor Image. Got
{
type
(
inpt
)
}
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment