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
8f0ef5a7
Commit
8f0ef5a7
authored
Jan 08, 2019
by
surgan12
Committed by
Francisco Massa
Jan 08, 2019
Browse files
Doc changes (#711)
* doc change * doc changes * lint_checks * Update transforms.py
parent
84896a6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
torchvision/transforms/functional.py
torchvision/transforms/functional.py
+1
-1
torchvision/transforms/transforms.py
torchvision/transforms/transforms.py
+5
-1
No files found.
torchvision/transforms/functional.py
View file @
8f0ef5a7
...
@@ -77,7 +77,7 @@ def to_tensor(pic):
...
@@ -77,7 +77,7 @@ def to_tensor(pic):
img
=
255
*
torch
.
from_numpy
(
np
.
array
(
pic
,
np
.
uint8
,
copy
=
False
))
img
=
255
*
torch
.
from_numpy
(
np
.
array
(
pic
,
np
.
uint8
,
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: L, P, I, F, RGB, YCbCr, RGBA, CMYK
# PIL image mode: L,
LA,
P, I, F, RGB, YCbCr, RGBA, CMYK
if
pic
.
mode
==
'YCbCr'
:
if
pic
.
mode
==
'YCbCr'
:
nchannel
=
3
nchannel
=
3
elif
pic
.
mode
==
'I;16'
:
elif
pic
.
mode
==
'I;16'
:
...
...
torchvision/transforms/transforms.py
View file @
8f0ef5a7
...
@@ -73,7 +73,11 @@ class ToTensor(object):
...
@@ -73,7 +73,11 @@ class ToTensor(object):
"""Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor.
"""Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor.
Converts a PIL Image or numpy.ndarray (H x W x C) in the range
Converts a PIL Image or numpy.ndarray (H x W x C) in the range
[0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0].
[0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0]
if the PIL Image belongs to one of the modes (L, LA, P, I, F, RGB, YCbCr, RGBA, CMYK, 1)
or if the numpy.ndarray has dtype = np.uint8
In the other cases, tensors are returned without scaling.
"""
"""
def
__call__
(
self
,
pic
):
def
__call__
(
self
,
pic
):
...
...
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