Tensorflow 2.16.1 for c++ on win 11

I have already trained a LSTM model in python using tensorflow/keras. The model prediction speed are lower than required. So, I want to deploy the model in C++ to speed up the real time prediction.
I have followed the guide to build tensorflow form source on windows. Then, I defined the include directory for header files in visual studio but I don’t know what should I do about libraries and .dll. I mean I don’t know which .lib I have to define to visual studio and also I did not find any .dll file.

Tensorflow 2.16.1
Visual studio 2019

1 Like

Actually, if you’re trying to build Tensorflow in Windows for using the C++ API, you probably have to build these specific targets in your bazel build command for building the DLL file and also generating an import library (*.lib) file.

But the problem with the generated DLL file is that, some symbols may be missing in the final DLL file, due to there being a limit on how many symbols can be stored in a DLL file, which is I believe, 65535 symbols. We may have to use TF_EXPORT to export specific Class/Methods that we might need explicitly.

bazelisk build --config=opt //tensorflow:tensorflow.dll //tensorflow:tensorflow.lib //tensorflow:install_headers

So whats the deal with tensorflow_cc?

I can build tensorflow.dll, but for the life of me, I’m complete unable to build tensorflow_cc.

Which one is the C++ API?

I’m confused with the tensorflow.dll for C they provide, the tensorflow.dll I’m able to build, the tensorflow_cc which seems imposible to build (using MSVC (Seems there is a long running issue with long paths in bazel with c++ which cannot be solved with --output_user_root and that is also not documented), how to use clag (which also has 0 documentation, and I have been unable to configure), how to export the missing symbols… the complete lack of documentation and support, the lack of prebuilt .dlls …

I’m a PhD in computer science, and I have wasted almost 100 hours just trying to build this thing.

Discorcouraging does not even approach how bad the situation is for windows c++ users, even when not considering the drop of GPU support.