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
38cd6b39
Unverified
Commit
38cd6b39
authored
Aug 23, 2022
by
Philip Meier
Committed by
GitHub
Aug 23, 2022
Browse files
fix wording in query_chw (#6471)
parent
3bb4441b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
torchvision/prototype/transforms/_utils.py
torchvision/prototype/transforms/_utils.py
+5
-5
No files found.
torchvision/prototype/transforms/_utils.py
View file @
38cd6b39
...
...
@@ -33,16 +33,16 @@ def get_chw(image: Union[PIL.Image.Image, torch.Tensor, features.Image]) -> Tupl
def
query_chw
(
sample
:
Any
)
->
Tuple
[
int
,
int
,
int
]:
flat_sample
,
_
=
tree_flatten
(
sample
)
image_dimensions
s
=
{
chw
s
=
{
get_chw
(
item
)
for
item
in
flat_sample
if
isinstance
(
item
,
(
features
.
Image
,
PIL
.
Image
.
Image
))
or
is_simple_tensor
(
item
)
}
if
not
image_dimensions
s
:
if
not
chw
s
:
raise
TypeError
(
"No image was found in the sample"
)
elif
len
(
image_dimensions
s
)
>
2
:
raise
TypeError
(
f
"Found multiple
image
dimensions in the sample:
{
sequence_to_str
(
sorted
(
image_dimensions
s
))
}
"
)
return
image_dimensions
s
.
pop
()
elif
len
(
chw
s
)
>
2
:
raise
TypeError
(
f
"Found multiple
CxHxW
dimensions in the sample:
{
sequence_to_str
(
sorted
(
chw
s
))
}
"
)
return
chw
s
.
pop
()
def
has_any
(
sample
:
Any
,
*
types_or_checks
:
Union
[
Type
,
Callable
[[
Any
],
bool
]])
->
bool
:
...
...
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