sh 如何正确安装tensorflow_cc
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 如何正确安装tensorflow_cc相关的知识,希望对你有一定的参考价值。
#! /bin/bash
# Requires bazel 0.19.2
# wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel_0.19.2-linux-x86_64.deb
# dpkg -i bazel_0.19.2-linux-x86_64.deb
# rm bazel_0.19.2-linux-x86_64.deb
git clone https://github.com/FloopCZ/tensorflow_cc.git
cd tensorflow_cc && git checkout v1.12.0
# Edit tensorflow install settings
sed -i "s|master\ \-\-\ tensorflow\/tf\_version\_script\.lds|v1\.13\.0\-rc0|g" tensorflow_cc/tensorflow_cc/cmake/TensorflowBa se.cmake
sed -i "s|ivybridge|native|g" tensorflow_cc/tensorflow_cc/cmake/build_tensorflow.sh.in
# sed -i "s|TF\_NEED\_TENSORRT\:\-0|TF\_NEED\_TENSORRT\:\-1|g" ./tensorflow_cc/tensorflow_cc/cmake/build_tensorflow.sh.in
# sed -i '/g++-7/d' ./tensorflow_cc/tensorflow_cc/cmake/TensorflowShared.cmake
mkdir -p ./tensorflow_cc/tensorflow_cc/build
cd tensorflow_cc/tensorflow_cc/build && cmake -DTENSORFLOW_STATIC=OFF -DTENSORFLOW_SHARED=ON .. && \
make -j8 && sudo make install && rm -rf ~/.cache && cd .. && rm -rf build
#! /bin/bash
# Requires bazel 0.19.2
# wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel_0.19.2-linux-x86_64.deb
# dpkg -i bazel_0.19.2-linux-x86_64.deb
# rm bazel_0.19.2-linux-x86_64.deb
git clone https://github.com/FloopCZ/tensorflow_cc.git
cd tensorflow_cc && git checkout v1.12.0
sed -i "s|master\ \-\-\ tensorflow\/tf\_version\_script\.lds|v1\.13\.0\-rc0|g" tensorflow_cc/cmake/TensorflowBase.cmake
sed -i "s|ivybridge|native|g" tensorflow_cc/cmake/build_tensorflow.sh.in
sed -i "s|TF\_NEED\_TENSORRT\:\-0|TF\_NEED\_TENSORRT\:\-1|g" tensorflow_cc/cmake/build_tensorflow.sh.in
sed -i '/g++-7/d' tensorflow_cc/cmake/TensorflowShared.cmake
sed -i "/set\ \-e/a sed\ \-i\ '\/\\\"\\\/\\\/tensorflow\\\/cc\\\:scope\\\"\\\,\/a\ \\\"\\\/\\\/tensorflow\\\/contrib\\\/tensorrt\\\:trt\\\_conversion\\\"\\\,'\ \/tensorflow_cc\/tensorflow_cc\/build\/tensorflow\/tensorflow\/BUILD" tensorflow_cc/cmake/build_tensorflow.sh.in
sed -i "/set\ \-e/a sed\ \-i\ '\/\\\"\\\/\\\/tensorflow\\\/cc\\\:scope\\\"\\\,\/a\ \\\"\\\/\\\/tensorflow\\\/contrib\\\/tensorrt\\\:trt\\\_engine\\\_op\\\_kernel\\\"\\\,'\ \/tensorflow_cc\/tensorflow_cc\/build\/tensorflow\/tensorflow\/BUILD" tensorflow_cc/cmake/build_tensorflow.sh.in
sed -i "/set\ \-e/a sed\ \-i\ '\/\\\"kernels\\\/trt\\\_engine\\\_op\\\.cc\\\"\\\,\/a\ \\\"ops\\\/trt\\\_engine\\\_op\\\.cc\\\"\\\,'\ \/tensorflow_cc\/tensorflow_cc\/build\/tensorflow\/tensorflow\/contrib\/tensorrt\/BUILD" tensorflow_cc/cmake/build_tensorflow.sh.in
sed -i "/set\ \-e/a sed\ \-i\ '\/\\\"\\\:trt\\\_resources\\\"\\\,\/a\ \\\"\\\:trt\\\_shape\\\_function\\\"\\\,'\ \/tensorflow_cc\/tensorflow_cc\/build\/tensorflow\/tensorflow\/contrib\/tensorrt\/BUILD" tensorflow_cc/cmake/build_tensorflow.sh.in
mkdir -p tensorflow_cc/build
cd tensorflow_cc/build
cmake -DTENSORFLOW_STATIC=OFF -DTENSORFLOW_SHARED=ON ..
make -j8 && make install && rm -rf ~/.cache && cd .. && rm -rf build
以上是关于sh 如何正确安装tensorflow_cc的主要内容,如果未能解决你的问题,请参考以下文章
sh 正确安装NTFS
sh 为WordPress安装设置正确的文件权限 - 来自http://stackoverflow.com/questions/18352682/correct-file-permissions-fo
mac上安装virtualenvwrapper的正确姿势
如何从 Ubuntu 中的启动终端执行脚本正确启动脚本?
如何正确配置代理
如何安装 sbt-sh 插件