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
6d2423c7
Commit
6d2423c7
authored
Mar 23, 2017
by
Bodo Kaiser
Committed by
Soumith Chintala
Mar 23, 2017
Browse files
added copy=False to np.array constructor
parent
991bad2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchvision/transforms.py
torchvision/transforms.py
+2
-2
No files found.
torchvision/transforms.py
View file @
6d2423c7
...
@@ -43,9 +43,9 @@ class ToTensor(object):
...
@@ -43,9 +43,9 @@ class ToTensor(object):
return
img
.
float
().
div
(
255
)
return
img
.
float
().
div
(
255
)
# handle PIL Image
# handle PIL Image
if
pic
.
mode
==
'I'
:
if
pic
.
mode
==
'I'
:
img
=
torch
.
from_numpy
(
np
.
array
(
pic
,
np
.
int32
))
img
=
torch
.
from_numpy
(
np
.
array
(
pic
,
np
.
int32
,
copy
=
False
))
elif
pic
.
mode
==
'I;16'
:
elif
pic
.
mode
==
'I;16'
:
img
=
torch
.
from_numpy
(
np
.
array
(
pic
,
np
.
int16
))
img
=
torch
.
from_numpy
(
np
.
array
(
pic
,
np
.
int16
,
copy
=
False
))
else
:
else
:
img
=
torch
.
ByteTensor
(
torch
.
ByteStorage
.
from_buffer
(
pic
.
tobytes
()))
img
=
torch
.
ByteTensor
(
torch
.
ByteStorage
.
from_buffer
(
pic
.
tobytes
()))
# PIL image mode: 1, L, P, I, F, RGB, YCbCr, RGBA, CMYK
# PIL image mode: 1, L, P, I, F, RGB, YCbCr, RGBA, CMYK
...
...
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