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
3feb5021
"...api/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "88fa6b7d68d77b2531462ebe5a339b8c5b034ce4"
Unverified
Commit
3feb5021
authored
Dec 04, 2023
by
Philip Meier
Committed by
GitHub
Dec 04, 2023
Browse files
remove redundant typing casts (#8140)
parent
c1e2095c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
4 deletions
+2
-4
torchvision/prototype/tv_tensors/_label.py
torchvision/prototype/tv_tensors/_label.py
+1
-1
torchvision/transforms/v2/_geometry.py
torchvision/transforms/v2/_geometry.py
+1
-3
No files found.
torchvision/prototype/tv_tensors/_label.py
View file @
3feb5021
...
@@ -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
):
...
...
torchvision/transforms/v2/_geometry.py
View file @
3feb5021
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)"
)
...
...
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