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
7f5b2c42
Unverified
Commit
7f5b2c42
authored
Sep 18, 2020
by
dddzg
Committed by
GitHub
Sep 18, 2020
Browse files
make the tensor continuous when pass numpy object to tensor (#2483)
Co-authored-by:
vfdev
<
vfdev.5@gmail.com
>
parent
5e4a9f6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
torchvision/transforms/functional.py
torchvision/transforms/functional.py
+1
-1
No files found.
torchvision/transforms/functional.py
View file @
7f5b2c42
...
...
@@ -71,7 +71,7 @@ def to_tensor(pic):
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
)))
.
contiguous
()
# backward compatibility
if
isinstance
(
img
,
torch
.
ByteTensor
):
return
img
.
float
().
div
(
255
)
...
...
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