This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 4a02bde Some Python 3 fixes in ./tools again (#11757)
4a02bde is described below
commit 4a02bde9cb19bab97d1ac1348b3059793d715e73
Author: cclauss <[email protected]>
AuthorDate: Wed Jul 18 05:46:16 2018 +0200
Some Python 3 fixes in ./tools again (#11757)
---
tools/accnn/rank_selection.py | 4 +++-
tools/accnn/utils.py | 2 ++
tools/caffe_converter/convert_symbol.py | 2 ++
tools/coreml/test/test_mxnet_image.py | 6 ++++--
tools/coreml/test/test_mxnet_models.py | 5 ++++-
5 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/tools/accnn/rank_selection.py b/tools/accnn/rank_selection.py
index c5c0261..d25a465 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 b19521f..93b2e12 100644
--- a/tools/accnn/utils.py
+++ b/tools/accnn/utils.py
@@ -21,6 +21,8 @@ import copy
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 bbbdaa4..8faef04 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 e373cae..e754519 100644
--- a/tools/coreml/test/test_mxnet_image.py
+++ b/tools/coreml/test/test_mxnet_image.py
@@ -21,13 +21,15 @@ import numpy as np
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 @@ class ImageNetTest(unittest.TestCase):
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 36ac0ec..7c294db 100644
--- a/tools/coreml/test/test_mxnet_models.py
+++ b/tools/coreml/test/test_mxnet_models.py
@@ -21,11 +21,14 @@ import mxnet as mx
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):