首先要安装bazel tool
下载源码:git clone https://github.com/tensorflow/tensorflow.git
Build Tensorflow:
bazel build --jobs 6 //tensorflow:libtensorflow_cc.so
假如需要增加Intel CPU 加速:
bazel build --config=mkl --config=opt --jobs 6 //tensorflow:libtensorflow_cc.so
Build Tensorflow Lite:
编辑TensorFlow source code里面的"tensorflow/contrib/lite/BUILD"文件,增加:
cc_binary(
name = "libtflite.so",
deps = [":framework",
"//tensorflow/contrib/lite/kernels:builtin_ops",
"//tensorflow/contrib/lite/kernels:eigen_support",
"//tensorflow/contrib/lite/kernels:gemm_support",
],
linkopts=["-shared -Wl,--whole-archive" ],
linkshared=1
)
bazel build --jobs 6 //tensorflow/contrib/lite:libtflite.so --cxxopt="-std=c++11" --cop