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
3ebdb4df
"git@developer.sourcefind.cn:OpenDAS/mmcv.git" did not exist on "987d34b0cf8d6cd8725258332fcfc8c54529b1ab"
Commit
3ebdb4df
authored
Dec 15, 2016
by
Adam Lerer
Browse files
python 3 fixes
parent
e4c811c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
torchvision/datasets/cifar.py
torchvision/datasets/cifar.py
+4
-1
torchvision/datasets/lsun.py
torchvision/datasets/lsun.py
+1
-1
torchvision/utils.py
torchvision/utils.py
+2
-2
No files found.
torchvision/datasets/cifar.py
View file @
3ebdb4df
...
@@ -49,7 +49,10 @@ class CIFAR10(data.Dataset):
...
@@ -49,7 +49,10 @@ class CIFAR10(data.Dataset):
f
=
fentry
[
0
]
f
=
fentry
[
0
]
file
=
os
.
path
.
join
(
root
,
self
.
base_folder
,
f
)
file
=
os
.
path
.
join
(
root
,
self
.
base_folder
,
f
)
fo
=
open
(
file
,
'rb'
)
fo
=
open
(
file
,
'rb'
)
entry
=
pickle
.
load
(
fo
)
if
sys
.
version_info
[
0
]
==
2
:
entry
=
pickle
.
load
(
fo
)
else
:
entry
=
pickle
.
load
(
fo
,
encoding
=
'latin1'
)
self
.
train_data
.
append
(
entry
[
'data'
])
self
.
train_data
.
append
(
entry
[
'data'
])
if
'labels'
in
entry
:
if
'labels'
in
entry
:
self
.
train_labels
+=
entry
[
'labels'
]
self
.
train_labels
+=
entry
[
'labels'
]
...
...
torchvision/datasets/lsun.py
View file @
3ebdb4df
...
@@ -71,7 +71,7 @@ class LSUN(data.Dataset):
...
@@ -71,7 +71,7 @@ class LSUN(data.Dataset):
for
c
in
classes
:
for
c
in
classes
:
c_short
=
c
.
split
(
'_'
)
c_short
=
c
.
split
(
'_'
)
c_short
.
pop
(
len
(
c_short
)
-
1
)
c_short
.
pop
(
len
(
c_short
)
-
1
)
c_short
=
string
.
join
(
c_short
,
'_'
)
c_short
=
'_'
.
join
(
c_short
)
if
c_short
not
in
categories
:
if
c_short
not
in
categories
:
raise
(
ValueError
(
'Unknown LSUN class: '
+
c_short
+
'.'
\
raise
(
ValueError
(
'Unknown LSUN class: '
+
c_short
+
'.'
\
'Options are: '
+
str
(
categories
)))
'Options are: '
+
str
(
categories
)))
...
...
torchvision/utils.py
View file @
3ebdb4df
...
@@ -28,8 +28,8 @@ def make_grid(tensor, nrow=8, padding=2):
...
@@ -28,8 +28,8 @@ def make_grid(tensor, nrow=8, padding=2):
for
x
in
range
(
xmaps
):
for
x
in
range
(
xmaps
):
if
k
>=
nmaps
:
if
k
>=
nmaps
:
break
break
grid
.
narrow
(
1
,
y
*
height
+
1
+
padding
/
2
,
height
-
padding
)
\
grid
.
narrow
(
1
,
y
*
height
+
1
+
padding
/
/
2
,
height
-
padding
)
\
.
narrow
(
2
,
x
*
width
+
1
+
padding
/
2
,
width
-
padding
)
\
.
narrow
(
2
,
x
*
width
+
1
+
padding
/
/
2
,
width
-
padding
)
\
.
copy_
(
tensor
[
k
])
.
copy_
(
tensor
[
k
])
k
=
k
+
1
k
=
k
+
1
return
grid
return
grid
...
...
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