bazel和tensorflow有严格的对应版本,对应关系如下:
- 编译tensorflow之前先要安装bazel;
去https://github.com/bazelbuild/bazel/releases/tag/0.19.2下载需要的dbe,采用dpkg -i bazel_0.19.2-linux-x86_64.deb安装。
- 编译tensorflow
$ git clone https://github.com/tensorflow/tensorflow.git
$ cd tensorflow
$ git checkout r1.13 # r1.9, r1.10, etc.(这里选用的r1.13)
$ ./configure
在configure时,其他选项选择no,CUDA选项选择yes,configure成功之后,然后编译GPU版本的tensorflow。
$ bazel build --config=opt --config=cuda //tensorflow/tools/graph_transforms:transform_graph