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
c7191d56
Commit
c7191d56
authored
Feb 28, 2019
by
Surgan Jandial
Committed by
Francisco Massa
Feb 28, 2019
Browse files
view changed to unsqueeze (#765)
parent
d900d813
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchvision/utils.py
torchvision/utils.py
+2
-2
No files found.
torchvision/utils.py
View file @
c7191d56
...
...
@@ -35,11 +35,11 @@ def make_grid(tensor, nrow=8, padding=2,
tensor
=
torch
.
stack
(
tensor
,
dim
=
0
)
if
tensor
.
dim
()
==
2
:
# single image H x W
tensor
=
tensor
.
view
(
1
,
tensor
.
size
(
0
),
tensor
.
si
ze
(
1
)
)
tensor
=
tensor
.
unsquee
ze
(
0
)
if
tensor
.
dim
()
==
3
:
# single image
if
tensor
.
size
(
0
)
==
1
:
# if single-channel, convert to 3-channel
tensor
=
torch
.
cat
((
tensor
,
tensor
,
tensor
),
0
)
tensor
=
tensor
.
view
(
1
,
tensor
.
size
(
0
),
tensor
.
size
(
1
),
tensor
.
size
(
2
)
)
tensor
=
tensor
.
unsqueeze
(
0
)
if
tensor
.
dim
()
==
4
and
tensor
.
size
(
1
)
==
1
:
# single-channel images
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