Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

skylook/tensorflow_cpp

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tensorflow examples for C/C++

This project includes source code for my blog:

  1. Tensorflow C: from training to serving (In Chinese)

  2. Tensorflow C++: from training to serving (In Chinese)

996.icu

1. Dependancies

  1. For C API, download sdk from https://www.tensorflow.org/install/lang_c and put it into third_party/tensorflow_cpu (default) or third_party/tensorflow_gpu folder.

  2. For C++ API, follow the steps in Tensorflow C++: from training to serving (In Chinese) or Tensorflow C++ API to build tensorflow on your platform.

The C++ API is only designed to work with TensorFlow bazel build, which means you have to build tensorflow on every devices. If you need a stand-alone option, we suggest you use the C API.

2. Build

Prepare

mkdir build
cd build

CMake

For C API, run:

cmake .. -DUSE_TENSORFLOW_C=ON

For C++ API, run:

cmake .. -DUSE_TENSORFLOW_CPP=ON

Build

make

3. Run

For C++ Example (Simple Net)

./load_simple_net ../simple/model/simple.pb

For C++ Example (CNN Net)

./load_predict_cnn ../fashion_mnist/models/fashion_mnist.h5.pb ../fashion_mnist/fashion_0.png

For C Example (Simple Net)

./load_simple_net_c_api ../simple/model/simple.pb

For C Example (CNN Net)

./load_predict_cnn_c_api ../fashion_mnist/models/fashion_mnist.h5.pb ../fashion_mnist/fashion_0.png

Contact

My Blog: www.liuxiao.org

If you have any question, please contact liuxiao at foxmail.com

About

C and C++ examples for tensorflow

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.