ubuntu16.04中tensorflow压缩模型transform_graph编译

1、安装bazel

官网安装指南:https://docs.bazel.build/versions/master/install-ubuntu.html#install-with-installer-ubuntu

发布版本:https://github.com/bazelbuild/bazel/releases

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python

wget https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-installer-linux-x86_64.sh

sudo chmod +x bazel-0.21.0-installer-linux-x86_64.sh

export PATH="$PATH:$HOME/bin"

注意:一定要安装最新版本的bazel,否则在编译代码时可能会报错,具体可见我的另一篇博文:

https://blog.csdn.net/weixin_41770169/article/details/90041269

2、编译代码

下载最新的TensorFlow库
git clone https://github.com/tensorflow/tensorflow.git
cd ./tensorflow
编译graph_transforms模块,需要等待一段时间,编译很耗费CPU资源和时间
bazel build tensorflow/tools/graph_transforms:transform_graph

参考:https://blog.csdn.net/shiheyingzhe/article/details/86663889

猜你喜欢

转载自blog.csdn.net/weixin_41770169/article/details/90043157