nswamy closed pull request #12961: Update module example
URL: https://github.com/apache/incubator-mxnet/pull/12961
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/example/utils/__init__.py b/example/module/utils/__init__.py
similarity index 100%
rename from example/utils/__init__.py
rename to example/module/utils/__init__.py
diff --git a/example/utils/get_data.py b/example/module/utils/get_data.py
similarity index 94%
rename from example/utils/get_data.py
rename to example/module/utils/get_data.py
index 861d16cdbad..2a585ead385 100644
--- a/example/utils/get_data.py
+++ b/example/module/utils/get_data.py
@@ -17,6 +17,7 @@
import os
import mxnet as mx
+import zipfile
def get_mnist(data_dir):
if not os.path.isdir(data_dir):
@@ -28,7 +29,7 @@ def get_mnist(data_dir):
(not os.path.exists('t10k-labels-idx1-ubyte')):
import urllib, zipfile
zippath = os.path.join(os.getcwd(), "mnist.zip")
- urllib.urlretrieve("http://data.mxnet.io/mxnet/data/mnist.zip",
zippath)
+ mx.test_utils.download("http://data.mxnet.io/mxnet/data/mnist.zip",
zippath)
zf = zipfile.ZipFile(zippath, "r")
zf.extractall()
zf.close()
@@ -45,7 +46,7 @@ def get_cifar10(data_dir):
import urllib, zipfile, glob
dirname = os.getcwd()
zippath = os.path.join(dirname, "cifar10.zip")
- urllib.urlretrieve("http://data.mxnet.io/mxnet/data/cifar10.zip",
zippath)
+ mx.test_utils.download("http://data.mxnet.io/mxnet/data/cifar10.zip",
zippath)
zf = zipfile.ZipFile(zippath, "r")
zf.extractall()
zf.close()
@@ -56,7 +57,6 @@ def get_cifar10(data_dir):
os.rmdir(os.path.join(dirname, "cifar"))
os.chdir(cwd)
-# data
def get_cifar10_iterator(args, kv):
data_shape = (3, 28, 28)
data_dir = args.data_dir
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services