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
6ee98fc6
Commit
6ee98fc6
authored
Dec 14, 2018
by
surgan12
Committed by
Francisco Massa
Dec 14, 2018
Browse files
bug fixes to_tensor (#686)
* bug fixes to_tensor * tensor checked
parent
0ce81569
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
torchvision/transforms/functional.py
torchvision/transforms/functional.py
+3
-0
No files found.
torchvision/transforms/functional.py
View file @
6ee98fc6
...
@@ -51,6 +51,9 @@ def to_tensor(pic):
...
@@ -51,6 +51,9 @@ def to_tensor(pic):
if
isinstance
(
pic
,
np
.
ndarray
):
if
isinstance
(
pic
,
np
.
ndarray
):
# handle numpy array
# handle numpy array
if
pic
.
ndim
==
2
:
pic
=
pic
[:,
:,
None
]
img
=
torch
.
from_numpy
(
pic
.
transpose
((
2
,
0
,
1
)))
img
=
torch
.
from_numpy
(
pic
.
transpose
((
2
,
0
,
1
)))
# backward compatibility
# backward compatibility
if
isinstance
(
img
,
torch
.
ByteTensor
):
if
isinstance
(
img
,
torch
.
ByteTensor
):
...
...
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