Git Product home page Git Product logo

tensorflow_cpp's Introduction

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

tensorflow_cpp's People

Contributors

skylook avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.