You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/01/26 18:05:25 UTC

[GitHub] piiswrong closed pull request #9570: Add checksum for file download in test_consistency

piiswrong closed pull request #9570: Add checksum for file download in test_consistency
URL: https://github.com/apache/incubator-mxnet/pull/9570
 
 
   

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/tests/python/gpu/test_forward.py b/tests/python/gpu/test_forward.py
index cddf9afb9c..793ad549de 100644
--- a/tests/python/gpu/test_forward.py
+++ b/tests/python/gpu/test_forward.py
@@ -19,6 +19,7 @@
 import numpy as np
 import mxnet as mx
 from mxnet.test_utils import *
+from mxnet.gluon import utils
 
 def _get_model():
     if not os.path.exists('model/Inception-7-symbol.json'):
@@ -41,8 +42,19 @@ def _dump_images(shape):
     np.save('data/test_images_%d_%d.npy'%shape, imgs)
 
 def _get_data(shape):
-    download("http://data.mxnet.io/data/test_images_%d_%d.npy" % (shape), dirname='data')
-    download("http://data.mxnet.io/data/inception-v3-dump.npz", dirname="data")
+    hash_test_img = "355e15800642286e7fe607d87c38aeeab085b0cc"
+    hash_inception_v3 = "91807dfdbd336eb3b265dd62c2408882462752b9"
+    fname = utils.download("http://data.mxnet.io/data/test_images_%d_%d.npy" % (shape),
+                           path="data/test_images_%d_%d.npy" % (shape),
+                           sha1_hash=hash_test_img)
+    if not utils.check_sha1(fname, hash_test_img):
+        raise RuntimeError("File %s not downloaded completely" % ("test_images_%d_%d.npy"%(shape)))
+
+    fname = utils.download("http://data.mxnet.io/data/inception-v3-dump.npz",
+                           path='data/inception-v3-dump.npz',
+                           sha1_hash=hash_inception_v3)
+    if not utils.check_sha1(fname, hash_inception_v3):
+        raise RuntimeError("File %s not downloaded completely" % ("inception-v3-dump.npz"))
 
 def test_consistency(dump=False):
     shape = (299, 299)


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services