Neargye/hello_tf_c_api

Neural Network TensorFlow C API

What it solves

This project provides a cross-platform set of practical examples for using the TensorFlow C API. It simplifies the process of integrating TensorFlow's native libraries into C++ applications on Windows, Linux, and macOS, reducing the boilerplate required to load graphs, manage tensors, and run inference.

How it works

The project uses CMake to automate the downloading and linking of the TensorFlow 2.21.0 Python wheel's C API headers and native libraries. It includes a helper library (hello_tf_utils) that wraps raw C API calls to make them more accessible. The examples demonstrate various core operations, such as loading a GraphDef, creating tensors (including string tensors), and performing repeated inference.

Who it’s for

Developers who need to run TensorFlow models in a native C++ environment without the overhead of the Python runtime, specifically those targeting cross-platform deployment.

Highlights

  • Cross-platform support: Works on Windows, Linux, and macOS.
  • Comprehensive examples: Covers everything from basic tensor creation to image processing with OpenCV.
  • Automated dependency management: Uses CMake to fetch and configure the TensorFlow C API automatically.
  • Native performance: Enables running inference using the native C API for better efficiency in production environments.

Related

  • Project
  • Project
  • Project
  • Project