szha closed pull request #11757: Some Python 3 fixes in ./tools again
URL: https://github.com/apache/incubator-mxnet/pull/11757
 
 
   

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/tools/accnn/rank_selection.py b/tools/accnn/rank_selection.py
index c5c026114ae..d25a465a628 100644
--- a/tools/accnn/rank_selection.py
+++ b/tools/accnn/rank_selection.py
@@ -16,12 +16,14 @@
 # under the License.
 
 import numpy as np
-import mxnet as mx
 import json
 import utils
 import math
 import sys
 
+from six.moves import xrange
+
+
 def calc_complexity(ishape, node):
   y, x = map(int, eval(node['param']['kernel']))
   N = int(node['param']['num_filter'])
diff --git a/tools/accnn/utils.py b/tools/accnn/utils.py
index b19521f9e86..93b2e12d124 100644
--- a/tools/accnn/utils.py
+++ b/tools/accnn/utils.py
@@ -21,6 +21,8 @@
 import json
 import ast
 
+from six.moves import xrange
+
 
 def load_model(args):
   devs = mx.cpu() if args.gpus == None else [mx.gpu(int(i)) for i in 
args.gpus.split(',')]
diff --git a/tools/caffe_converter/convert_symbol.py 
b/tools/caffe_converter/convert_symbol.py
index bbbdaa44e31..8faef04fe21 100644
--- a/tools/caffe_converter/convert_symbol.py
+++ b/tools/caffe_converter/convert_symbol.py
@@ -20,8 +20,10 @@
 from __future__ import print_function
 import argparse
 import re
+import mxnet as mx
 import caffe_parser
 
+
 def _get_input(proto):
     """Get input size
     """
diff --git a/tools/coreml/test/test_mxnet_image.py 
b/tools/coreml/test/test_mxnet_image.py
index e373caeba93..e75451961a9 100644
--- a/tools/coreml/test/test_mxnet_image.py
+++ b/tools/coreml/test/test_mxnet_image.py
@@ -21,13 +21,15 @@
 import unittest
 import sys
 import os
+
+from six.moves import xrange
+
 current_working_directory = os.getcwd()
 sys.path.append(current_working_directory + "/..")
 sys.path.append(current_working_directory + "/../converter/")
 import _mxnet_converter as mxnet_converter
 from converter.utils import load_model
 
-
 VAL_DATA = 'data/val-5k-256.rec'
 URL = 'http://data.mxnet.io/data/val-5k-256.rec'
 
@@ -134,4 +136,4 @@ def test_vgg16(self):
 
 if __name__ == '__main__':
     suite = unittest.TestLoader().loadTestsFromTestCase(ImageNetTest)
-    unittest.TextTestRunner(verbosity=2).run(suite)
\ No newline at end of file
+    unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/tools/coreml/test/test_mxnet_models.py 
b/tools/coreml/test/test_mxnet_models.py
index 36ac0ece364..7c294db8611 100644
--- a/tools/coreml/test/test_mxnet_models.py
+++ b/tools/coreml/test/test_mxnet_models.py
@@ -21,11 +21,14 @@
 import numpy as np
 import sys
 import os
+from collections import namedtuple
+
+from six.moves import xrange
+
 current_working_directory = os.getcwd()
 sys.path.append(current_working_directory + "/..")
 sys.path.append(current_working_directory + "/../converter/")
 import _mxnet_converter as mxnet_converter
-from collections import namedtuple
 
 
 def _mxnet_remove_batch(input_data):


 

----------------------------------------------------------------
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

Reply via email to