From 4faee3942d9983e0c96091b32095cc0d9ff494e0 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Tue, 27 Feb 2018 07:36:01 +0100 Subject: [PATCH] Fix some breakages in TensorFlow Windows build (#17271) * Fix configure.py * Add quantization_utils for building quantize_weights, quantize_nodes, round_weights Caused by https://github.com/tensorflow/tensorflow/pull/16121 --- configure.py | 8 ++++++-- tensorflow/core/kernels/BUILD | 16 ++++++++++++---- tensorflow/tools/graph_transforms/BUILD | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 7d2e30c..97f4675 100644 --- a/configure.py +++ b/configure.py @@ -250,7 +250,11 @@ def reset_tf_configure_bazelrc(workspace_path): if _TF_BAZELRC_FILENAME in l: continue f.write('%s\n' % l) - f.write('import %s\n' % _TF_BAZELRC) + if is_windows(): + tf_bazelrc_path = _TF_BAZELRC.replace("\\", "/") + else: + tf_bazelrc_path = _TF_BAZELRC + f.write('import %s\n' % tf_bazelrc_path) def cleanup_makefile(): @@ -444,7 +448,7 @@ def check_bazel_version(min_version): if which('bazel') is None: print('Cannot find bazel. Please install bazel.') sys.exit(0) - curr_version = run_shell(['bazel', '--batch', 'version']) + curr_version = run_shell(['bazel', '--batch', '--bazelrc=/dev/null', 'version']) for line in curr_version.split('\n'): if 'Build label: ' in line: diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index 3426cf6..78786de 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -5128,7 +5128,6 @@ tf_kernel_library( srcs = [ "dequantize_op.cc", "meta_support.cc", - "quantization_utils.cc", "quantize_down_and_shrink_range.cc", "quantize_op.cc", "quantized_activation_ops.cc", @@ -5149,7 +5148,6 @@ tf_kernel_library( ], hdrs = [ "meta_support.h", - "quantization_utils.h", "reference_gemm.h", ], deps = [ @@ -5160,6 +5158,7 @@ tf_kernel_library( ":image_resizer_state", ":ops_util", ":pooling_ops", + ":quantization_utils", "//tensorflow/core:array_ops_op_lib", "//tensorflow/core:core_cpu", "//tensorflow/core:framework", @@ -5707,6 +5706,16 @@ tf_kernel_library( ) cc_library( + name = "quantization_utils", + srcs = ["quantization_utils.cc"], + hdrs = ["quantization_utils.h"], + deps = [ + "//tensorflow/core:framework", + "@gemmlowp", + ], +) + +cc_library( name = "remote_fused_graph_execute_utils", srcs = [ "i_remote_fused_graph_ops_definitions.cc", @@ -6081,7 +6090,6 @@ cc_library( srcs = [ "cwise_ops_common.cc", "meta_support.cc", - "quantization_utils.cc", ], hdrs = [ "cwise_ops.h", @@ -6090,10 +6098,10 @@ cc_library( "cwise_ops_gpu_gradients.cu.h", "cwise_ops_gradients.h", "meta_support.h", - "quantization_utils.h", ], deps = [ ":bounds_check", + ":quantization_utils", "//tensorflow/core:framework", "//tensorflow/core:lib", "//third_party/eigen3", diff --git a/tensorflow/tools/graph_transforms/BUILD b/tensorflow/tools/graph_transforms/BUILD index ad3668f..4fe4fc3 100644 --- a/tensorflow/tools/graph_transforms/BUILD +++ b/tensorflow/tools/graph_transforms/BUILD @@ -134,8 +134,8 @@ cc_library( "//tensorflow/core:tensorflow", "//tensorflow/contrib/rnn:gru_ops_op_lib", "//tensorflow/contrib/rnn:lstm_ops_op_lib", + "//tensorflow/core/kernels:quantization_utils", ] + if_not_windows([ - "//tensorflow/core/kernels:quantized_ops", "//tensorflow/core/kernels:remote_fused_graph_rewriter_transform", "//tensorflow/core/kernels/hexagon:hexagon_rewriter_transform", ]), -- 2.7.4