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
b733ad1a
Commit
b733ad1a
authored
Dec 16, 2016
by
Soumith Chintala
Committed by
GitHub
Dec 16, 2016
Browse files
Merge pull request #17 from adamlerer/save_image
fix bugs in save_image
parents
8560d58b
19a27a21
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
torchvision/utils.py
torchvision/utils.py
+3
-2
No files found.
torchvision/utils.py
View file @
b733ad1a
...
@@ -16,9 +16,10 @@ def make_grid(tensor, nrow=8, padding=2):
...
@@ -16,9 +16,10 @@ def make_grid(tensor, nrow=8, padding=2):
for
i
in
range
(
numImages
):
for
i
in
range
(
numImages
):
tensor
[
i
].
copy_
(
tensorlist
[
i
])
tensor
[
i
].
copy_
(
tensorlist
[
i
])
if
tensor
.
dim
()
==
2
:
# single image H x W
if
tensor
.
dim
()
==
2
:
# single image H x W
tensor
=
torch
.
view
(
1
,
tensor
.
size
(
0
),
tensor
.
size
(
1
))
tensor
=
tensor
.
view
(
1
,
tensor
.
size
(
0
),
tensor
.
size
(
1
))
tensor
=
torch
.
cat
((
tensor
,
tensor
,
tensor
),
0
)
if
tensor
.
dim
()
==
3
:
# single image
if
tensor
.
dim
()
==
3
:
# single image
if
tensor
.
size
(
0
)
==
1
:
tensor
=
torch
.
cat
((
tensor
,
tensor
,
tensor
),
0
)
return
tensor
return
tensor
if
tensor
.
dim
()
==
4
and
tensor
.
size
(
1
)
==
1
:
# single-channel images
if
tensor
.
dim
()
==
4
and
tensor
.
size
(
1
)
==
1
:
# single-channel images
tensor
=
torch
.
cat
((
tensor
,
tensor
,
tensor
),
1
)
tensor
=
torch
.
cat
((
tensor
,
tensor
,
tensor
),
1
)
...
...
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