tensorflow 量化 bazel编译quantize_graph失败

参考【TensorFlow】quantization量化中的二

代码地址:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/quantize/python/quantize_graph.py 

curl http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz -o /tmp/inceptionv3.tgz 
tar xzf /tmp/inceptionv3.tgz -C /tmp/ 
bazel build tensorflow/contrib/quantization/tools:quantize_graph 
bazel-bin/tensorflow/contrib/quantization/tools/quantize_graph \ 
--input=/tmp/classify_image_graph_def.pb \ 
--output_node_names="softmax" 
--output=/tmp/quantized_graph.pb \ --mode=eightbit

其中quantize_graph的目录改变,更改代码为

bazel build tensorflow/contrib/quantize:quantize_graph

遇到报错

ERROR: /home/nnir712/project/tensorflow-master/tensorflow/core/grappler/costs/BUILD:281:1: C++ compilation of rule '//tensorflow/core/grappler/costs:op_level_cost_estimator' failed (Exit 1)
In file included from ./tensorflow/core/grappler/costs/op_level_cost_estimator.h:19:0,
                 from tensorflow/core/grappler/costs/op_level_cost_estimator.cc:16:
./tensorflow/core/grappler/costs/cost_estimator.h:58:52: error: 'INFINITY' was not declared in this scope
              double intermediate_read_gb_per_sec = INFINITY,
                                                    ^~~~~~~~
./tensorflow/core/grappler/costs/cost_estimator.h:59:53: error: 'INFINITY' was not declared in this scope
              double intermediate_write_gb_per_sec = INFINITY)
                                                     ^~~~~~~~
./tensorflow/core/grappler/costs/cost_estimator.h: In constructor 'tensorflow::grappler::DeviceInfo::DeviceInfo()':
./tensorflow/core/grappler/costs/cost_estimator.h:46:17: error: 'INFINITY' was not declared in this scope
       : gigaops(INFINITY),
                 ^~~~~~~~
tensorflow/core/grappler/costs/op_level_cost_estimator.cc: In member function 'virtual tensorflow::grappler::DeviceInfo tensorflow::grappler::OpLevelCostEstimator::GetDeviceInfo(const tensorflow::DeviceProperties&) const':
tensorflow/core/grappler/costs/op_level_cost_estimator.cc:442:39: error: call to 'tensorflow::grappler::DeviceInfo::DeviceInfo(double, double, double, double)' uses the default argument for parameter 3, which is not yet defined
   return DeviceInfo(gflops, gb_per_sec);
                                       ^
tensorflow/core/grappler/costs/op_level_cost_estimator.cc:442:39: error: call to 'tensorflow::grappler::DeviceInfo::DeviceInfo(double, double, double, double)' uses the default argument for parameter 4, which is not yet defined
In file included from ./tensorflow/core/platform/default/logging.h:24:0,
                 from ./tensorflow/core/platform/logging.h:25,
                 from ./tensorflow/core/lib/core/status.h:25,
                 from ./tensorflow/core/grappler/costs/cost_estimator.h:19,
                 from ./tensorflow/core/grappler/costs/op_level_cost_estimator.h:19,
                 from tensorflow/core/grappler/costs/op_level_cost_estimator.cc:16:
./tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetFilterDim(tensorflow::gtl::ArraySlice, tensorflow::FilterTensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice = absl::Span]':
./tensorflow/core/util/tensor_format.h:467:54:   required from here
./tensorflow/core/util/tensor_format.h:441:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   CHECK(index >= 0 && index < dimension_attribute.size())
./tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
 #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
                                               ^
./tensorflow/core/util/tensor_format.h:441:3: note: in expansion of macro 'CHECK'
   CHECK(index >= 0 && index < dimension_attribute.size())
   ^
Target //tensorflow/contrib/quantize:quantize_graph failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1340.504s, Critical Path: 68.45s
INFO: 1816 processes: 1816 local.

 

你可能感兴趣的:(TensorFlow,笔记)