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
c36cb6d2
Unverified
Commit
c36cb6d2
authored
Sep 22, 2020
by
Edgar Andrés Margffoy Tuay
Committed by
GitHub
Sep 22, 2020
Browse files
Update image IO ops to reflect CHW tensor layout return (#2695)
parent
fc490902
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torchvision/io/image.py
torchvision/io/image.py
+4
-4
No files found.
torchvision/io/image.py
View file @
c36cb6d2
...
@@ -33,7 +33,7 @@ def decode_png(input: torch.Tensor) -> torch.Tensor:
...
@@ -33,7 +33,7 @@ def decode_png(input: torch.Tensor) -> torch.Tensor:
the raw bytes of the PNG image.
the raw bytes of the PNG image.
Returns:
Returns:
output (Tensor[
image_width
, image_height,
3
])
output (Tensor[
3
, image_height,
image_width
])
"""
"""
if
not
isinstance
(
input
,
torch
.
Tensor
)
or
input
.
numel
()
==
0
or
input
.
ndim
!=
1
:
# type: ignore[attr-defined]
if
not
isinstance
(
input
,
torch
.
Tensor
)
or
input
.
numel
()
==
0
or
input
.
ndim
!=
1
:
# type: ignore[attr-defined]
raise
ValueError
(
"Expected a non empty 1-dimensional tensor."
)
raise
ValueError
(
"Expected a non empty 1-dimensional tensor."
)
...
@@ -53,7 +53,7 @@ def read_png(path: str) -> torch.Tensor:
...
@@ -53,7 +53,7 @@ def read_png(path: str) -> torch.Tensor:
path (str): path of the PNG image.
path (str): path of the PNG image.
Returns:
Returns:
output (Tensor[
image_width
, image_height,
3
])
output (Tensor[
3
, image_height,
image_width
])
"""
"""
if
not
os
.
path
.
isfile
(
path
):
if
not
os
.
path
.
isfile
(
path
):
raise
ValueError
(
"Expected a valid file path."
)
raise
ValueError
(
"Expected a valid file path."
)
...
@@ -73,7 +73,7 @@ def decode_jpeg(input: torch.Tensor) -> torch.Tensor:
...
@@ -73,7 +73,7 @@ def decode_jpeg(input: torch.Tensor) -> torch.Tensor:
input (Tensor[1]): a one dimensional int8 tensor containing
input (Tensor[1]): a one dimensional int8 tensor containing
the raw bytes of the JPEG image.
the raw bytes of the JPEG image.
Returns:
Returns:
output (Tensor[
image_width
, image_height,
3
])
output (Tensor[
3
, image_height,
image_width
])
"""
"""
if
not
isinstance
(
input
,
torch
.
Tensor
)
or
len
(
input
)
==
0
or
input
.
ndim
!=
1
:
# type: ignore[attr-defined]
if
not
isinstance
(
input
,
torch
.
Tensor
)
or
len
(
input
)
==
0
or
input
.
ndim
!=
1
:
# type: ignore[attr-defined]
raise
ValueError
(
"Expected a non empty 1-dimensional tensor."
)
raise
ValueError
(
"Expected a non empty 1-dimensional tensor."
)
...
@@ -92,7 +92,7 @@ def read_jpeg(path: str) -> torch.Tensor:
...
@@ -92,7 +92,7 @@ def read_jpeg(path: str) -> torch.Tensor:
Arguments:
Arguments:
path (str): path of the JPEG image.
path (str): path of the JPEG image.
Returns:
Returns:
output (Tensor[
image_width
, image_height,
3
])
output (Tensor[
3
, image_height,
image_width
])
"""
"""
if
not
os
.
path
.
isfile
(
path
):
if
not
os
.
path
.
isfile
(
path
):
raise
ValueError
(
"Expected a valid file path."
)
raise
ValueError
(
"Expected a valid file path."
)
...
...
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