博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Install TensorFlow for C
阅读量:2031 次
发布时间:2019-04-28

本文共 1984 字,大约阅读时间需要 6 分钟。

Table of Contents


Install TensorFlow for C

TensorFlow provides a C API that can be used to build . The API is defined in and designed for simplicity and uniformity rather than convenience.

Supported Platforms

TensorFlow for C is supported on the following systems:

  • Linux, 64-bit, x86
  • macOS X, Version 10.12.6 (Sierra) or higher
  • Windows, 64-bit x86

Setup

Download

TensorFlow C library URL
Linux
Linux CPU only
Linux GPU support
macOS
macOS CPU only
Windows
Windows CPU only
Windows GPU only

Extract

Extract the downloaded archive, which contains the header files to include in your C program and the shared libraries to link against.

On Linux and macOS, you may want to extract to /usr/local/lib:

sudo tar -C /usr/local -xzf (downloaded file)

Linker

On Linux/macOS, if you extract the TensorFlow C library to a system directory, such as /usr/local, configure the linker with ldconfig:

sudo ldconfig

If you extract the TensorFlow C library to a non-system directory, such as ~/mydir, then configure the linker environmental variables:

export LIBRARY_PATH=$LIBRARY_PATH:~/mydir/libexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/mydir/lib

Build

Example program

With the TensorFlow C library installed, create an example program with the following source code (hello_tf.c):

#include 
#include
int main() {  printf("Hello from TensorFlow C library version %s\n", TF_Version());  return 0;}

 

Compile

Compile the example program to create an executable, then run:

gcc hello_tf.c -ltensorflow -o hello_tf./hello_tf

The command outputs: Hello from TensorFlow C library version number

Success: The TensorFlow C library is configured.

If the program doesn't build, make sure that gcc can access the TensorFlow C library. If extracted to /usr/local, explicitly pass the library location to the compiler:

gcc -I/usr/local/include -L/usr/local/lib hello_tf.c -ltensorflow -o hello_tf

Build from source

TensorFlow is open source. Read  to build TensorFlow's C library from source code.


转载地址:http://eptaf.baihongyu.com/

你可能感兴趣的文章
【其他】【PL/SQL Developer】【2】报错Initialization error Could not load ".../oci.dll"解决方法...
查看>>
【Java】【28】提高List的removeAll方法的效率
查看>>
【JS】【28】让输入框只能输入正整数
查看>>
【记录】【4】各种工具
查看>>
【JS】【31】读取json文件
查看>>
Ubuntu Boost 编译
查看>>
MySQL中的行级锁,表级锁,页级锁
查看>>
ORACLE 修改SID
查看>>
OpenCV模块分析(转)
查看>>
聊聊我对写好程序的认识
查看>>
OpenSSL源代码学习[转]
查看>>
插件原理2[转自CSDN]
查看>>
COM编程快速入门[转自VCbase]
查看>>
VBA得到word中的超链接
查看>>
ComBSTR的使用
查看>>
硬回车与软回车[转]
查看>>
OpenCV Windows7 VC6.0安装以及HelloWorld
查看>>
python升级导致yum命令无法使用的解决办法
查看>>
vi/vim 中如何在每行行首或行尾插入指定字符串
查看>>
linux 查看端口被哪个程序占用
查看>>