TensorFlow in C++ without the Bazel tax
A thin C++ wrapper around TensorFlow's C API that lets you run SavedModels without compiling TensorFlow or touching malloc.
What it does
CppFlow wraps the TensorFlow 2 C API in modern C++ so you can load Python-trained SavedModels, manipulate tensors, and run inference. You download the prebuilt C API library, link against it, and skip the multi-hour Bazel build entirely. The API handles JPEG decoding, casting, normalization, and eager execution in a few lines of code.
The interesting bit
The raw_ops.h header—covering (mostly) all TensorFlow raw ops—is auto-generated by a Python script. That’s the kind of boring automation that saves you from manually wrapping hundreds of C functions with void pointers and manual memory management.
Key highlights
- Header-only C++ wrapper; no TensorFlow source build required
- Auto-generated facade over TensorFlow’s raw C ops
- RAII-style tensor and model classes (no manual
TF_DeleteTensor) - Eager execution and SavedModel loading supported
- Examples include full image-inference pipeline
Caveats
- Requires separate download of the TensorFlow C API binary; not fully self-contained
- README notes the project is “basically a wrapper”—don’t expect training or graph-building features
- Ops coverage is “(mostly) all” per the README; exact gaps unclear
Verdict
Worth a look if you need to deploy TensorFlow models in a C++ environment and can’t stomach Bazel. Skip it if you need training, custom ops, or a fully hermetic build.