diff --git a/docs/installation/env_requirement.rst b/docs/installation/env_requirement.rst index 5fce3955b4dec97144407a3e0ca4a6395bb872ce..cb1c5c0d1a7eac532541560f1ea1d5893fe48d2b 100644 --- a/docs/installation/env_requirement.rst +++ b/docs/installation/env_requirement.rst @@ -53,12 +53,13 @@ Optional dependencies - Remark * - Android NDK - `NDK installation guide `__ - - Required by Android build, r15b, r15c, r16b, r17b + - Required by Android build, r15b or higher version for bazel users, r17b or higher version for cmake users. * - Bazel - `bazel installation guide `__ - - 0.13.0 + - 0.13.0 * - ADB - - Linux:``apt-get install android-tools-adb`` Mac:``brew cask install android-platform-tools`` + - | Linux:``apt-get install android-tools-adb`` + | Mac:``brew cask install android-platform-tools`` - Required by Android run, >= 1.0.32 * - TensorFlow - pip install tensorflow==1.8.0 @@ -88,4 +89,5 @@ For python dependencies, - For Android build, `ANDROID_NDK_HOME` must be confifigured by using ``export ANDROID_NDK_HOME=/path/to/ndk`` - It will link ``libc++`` instead of ``gnustl`` if ``NDK version >= r17b`` and ``bazel version >= 0.13.0``, please refer to `NDK cpp-support `__. - For Mac, please install Homebrew at first before installing other dependencies. Set ANDROID_NDK_HOME in ``/etc/bashrc`` and then run ``source /etc/bashrc``. This installation was tested with macOS Mojave(10.14). - + +rs. \ No newline at end of file diff --git a/docs/user_guide/basic_usage_cmake.rst b/docs/user_guide/basic_usage_cmake.rst index 60e604161f1844653715fe091df56c2d901ede84..79a9a12089216c980e6ae4a049806b1220523e64 100644 --- a/docs/user_guide/basic_usage_cmake.rst +++ b/docs/user_guide/basic_usage_cmake.rst @@ -10,7 +10,7 @@ Before you do anything, clear the workspace used by build and test process. .. code-block:: sh - tools/clear_workspace.sh + tools/clear_workspace.sh [--expunge] Build Engine diff --git a/tools/clear_workspace.sh b/tools/clear_workspace.sh index 9635964b374e045fc4ca1d44abc3c2dd816e20c7..dce33181fbfe1e57fe99965768d99a75c8db3add 100755 --- a/tools/clear_workspace.sh +++ b/tools/clear_workspace.sh @@ -5,7 +5,7 @@ rm -rf mace/codegen/engine rm -rf mace/codegen/opencl for d in build/*; do - if [[ "$d" != "build/cmake-build" ]]; then + if [[ "$1" == "--expunge" || "$d" != "build/cmake-build" ]]; then echo "remove $d" rm -rf "$d" fi diff --git a/tools/image/image_to_tensor.py b/tools/image/image_to_tensor.py index 8dabe6db77200bb15a30e9635a0c68cb96362301..dd47dde7b7fbb5fc7992e4cd3b1bde294655383b 100644 --- a/tools/image/image_to_tensor.py +++ b/tools/image/image_to_tensor.py @@ -58,7 +58,7 @@ def images_to_tensors(input_files, image_shape, mean_values=None): align_corners=False) with tf.Session() as sess: - for i in xrange(len(input_files)): + for i in range(len(input_files)): with tf.gfile.FastGFile(input_files[i], 'rb') as f: src_image = f.read() dst_image = sess.run(image_data, diff --git a/tools/image/tensor_to_image.py b/tools/image/tensor_to_image.py index b9d9d4e78e8360966adb5b01e5e4bf8566b1f411..95f4ef700cb12c3060b847a09cfa0db15fd61d91 100644 --- a/tools/image/tensor_to_image.py +++ b/tools/image/tensor_to_image.py @@ -51,7 +51,7 @@ def tensors_to_images(input_files, image_shape, add_softmax): writer = tf.write_file(output, image_data, name='output_writer') with tf.Session() as sess: - for i in xrange(len(input_files)): + for i in range(len(input_files)): input_data = np.fromfile(input_files[i], dtype=np.float32) \ .reshape(image_shape) output_file = os.path.join(FLAGS.output_dir, os.path.splitext( diff --git a/tools/python/encrypt.py b/tools/python/encrypt.py index 263e4941232648e41ef9f491b1f52d9fb0b0e952..4dd14d8bf54500d09f835f70a8e46f8c66bab25d 100644 --- a/tools/python/encrypt.py +++ b/tools/python/encrypt.py @@ -33,8 +33,8 @@ from utils.config_parser import ModelKeys def generate_obfuscated_name(namespace, name, model_names_set): md5 = hashlib.md5() - md5.update(namespace) - md5.update(name) + md5.update(namespace.encode('utf-8')) + md5.update(name.encode('utf-8')) md5_digest = md5.hexdigest() name = md5_digest[:8] diff --git a/tools/python/quantize/quantize_stat.py b/tools/python/quantize/quantize_stat.py index a0f4d46b74252e3d82ff0dc5e576afbfcf20b24a..66a02fc3b708bf7c725f1d1a4cb2952b6a8fbbcf 100644 --- a/tools/python/quantize/quantize_stat.py +++ b/tools/python/quantize/quantize_stat.py @@ -67,7 +67,7 @@ class QuantizeStat(object): cur_max_idx = 0 cur_min = tensor_min cur_max = tensor_max - for i in xrange(samples): + for i in range(samples): if tensor_mins[i] + 0.1 > cur_max: break