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
nni
Commits
636ca9b5
"examples/trials/sklearn/vscode:/vscode.git/clone" did not exist on "8a08fab6f6391ae1fb1f799189768ac4acde26c5"
Unverified
Commit
636ca9b5
authored
Mar 19, 2021
by
J-shang
Committed by
GitHub
Mar 19, 2021
Browse files
new patch (#3460)
parent
7a1f05ae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
interim_vision_patch.py
interim_vision_patch.py
+11
-12
No files found.
interim_vision_patch.py
View file @
636ca9b5
...
@@ -3,18 +3,17 @@ import torchvision.datasets.mnist as mnist
...
@@ -3,18 +3,17 @@ import torchvision.datasets.mnist as mnist
file_name
=
mnist
.
__file__
file_name
=
mnist
.
__file__
dummy_file_name
=
os
.
path
.
join
(
os
.
path
.
dirname
(
file_name
),
'mnist_dummy.py'
)
dummy_file_name
=
os
.
path
.
join
(
os
.
path
.
dirname
(
file_name
),
'mnist_dummy.py'
)
with
open
(
file_name
,
'r'
)
as
fr
,
open
(
dummy_file_name
,
'w'
)
as
fw
:
with
open
(
file_name
,
'r'
)
as
fr
:
origin_text
=
fr
.
read
()
firstline
=
fr
.
readline
()
mnist_head
=
origin_text
.
find
(
'class MNIST('
)
if
firstline
!=
'from six.moves import urllib
\n
'
:
reasource_head
=
origin_text
.
find
(
'resources = ['
,
mnist_head
)
with
open
(
dummy_file_name
,
'w'
)
as
fw
:
reasource_tail
=
origin_text
.
find
(
']
\n
'
,
reasource_head
)
fw
.
writelines
([
'from six.moves import urllib
\n
'
,
top
=
origin_text
[:
reasource_head
]
'opener = urllib.request.build_opener()
\n
'
,
reasource
=
"resources = [('https://ossci-datasets.s3.amazonaws.com/mnist/train-images-idx3-ubyte.gz', 'f68b3c2dcbeaaa9fbdd348bbdeb94873'),('https://ossci-datasets.s3.amazonaws.com/mnist/train-labels-idx1-ubyte.gz', 'd53e105ee54ea40749a09fcbcd1e9432'),('https://ossci-datasets.s3.amazonaws.com/mnist/t10k-images-idx3-ubyte.gz', '9fb629c4189551a2d022fa330f9573f3'),('https://ossci-datasets.s3.amazonaws.com/mnist/t10k-labels-idx1-ubyte.gz', 'ec29112dd5afa0611ce80d1b7f02629c')]
\n
"
'opener.addheaders = [("User-agent", "Mozilla/5.0")]
\n
'
,
bottom
=
origin_text
[
reasource_tail
+
2
:]
'urllib.request.install_opener(opener)
\n\n
'
])
fw
.
write
(
top
)
fw
.
write
(
firstline
)
fw
.
write
(
reasource
)
for
line
in
fr
:
fw
.
write
(
bottom
)
fw
.
write
(
line
)
if
os
.
path
.
exists
(
dummy_file_name
):
if
os
.
path
.
exists
(
dummy_file_name
):
os
.
remove
(
file_name
)
os
.
remove
(
file_name
)
...
...
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