2016-11-02 35 views
0

我試圖建立freeze_graph.py過程中出現錯誤:freeze_graph.py拋出構建

bazel build tensorflow/python/tools:freeze_graph && \ bazel-bin/tensorflow/python/tools/freeze_graph \ --input_graph=some_graph_def.pb \ --input_checkpoint=model.ckpt-8361242 \ --output_graph=/tmp/frozen_graph.pb --output_node_names=softmax

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py

但第一個命令後,它拋出這個錯誤:

ERROR: /home/bernardo/.cache/bazel/_bazel_bernardo/6ec3db0a5b478824b301f4851c10d381/external/boringssl/BUILD:91:1: C++ compilation of rule '@boringssl//:crypto' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-canonical-system-headers ... (remaining 42 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. In file included from /usr/include/stdint.h:25:0, from /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/include/stdint.h:9, from external/boringssl/src/include/openssl/base.h:60, from external/boringssl/src/include/openssl/chacha.h:18, from external/boringssl/src/crypto/chacha/chacha.c:17: /usr/include/features.h:331:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^~~~~~~ cc1: all warnings being treated as errors Target //tensorflow/python/tools:freeze_graph failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 0.485s, Critical Path: 0.24s [[email protected] tensorflow]$

我試圖運行它來創建一個新的.pb文件來導入Android項目。

回答

0

我已經通過將添加到build命令來解決了這個問題。

用於構建freeze_graph整個命令是:

bazel build --copt=-O --config=cuda tensorflow/python/tools:freeze_graph 
0

從錯誤它的意思是說,它希望你用「-O」選項來構建優化版本。

+0

巴澤勒構建-O tensorflow /蟒/工具:freeze_graph ---- 無法識別的選項:-O – BernardoGO

+0

對於巴澤勒用於C++代碼,根據https://bazel.build/versions/master/docs/bazel-user-manual.html你應該使用「-c opt」。 (請參閱--compilation_mode部分) –

相關問題