0

I have a trained TensorFlow model that is correctly saved as a pb model to load into .NET and perform inference. The .NET program will build correctly if the target is a 64 bit (x64), but when the platform target is changed to 32 bit (x86), it will throw an exception:

enter image description here

If you google the exception a top result is a stack overflow response from 2019 where the second answer says:

Reason 1: Microsoft.ML works on x64 only

which does not look promising. However, earlier that year there was an article in devblogs.microsoft where a little more detail is given on the supported architecture:

  • x64 bit is supported on all platforms.
  • x86 is supported on Windows, except for TensorFlow, LightGBM, and ONNX related functionality.

Another article in devblogs.microsoft by the same author later in the year says:

ML.NET uses C++ code that is hard-coded to x86-based SSE instructions.

This sounds more promising since TensorFlow easily transfers into C++.

Since all of these were written almost 3 years ago, and there was support for x86 just not yet for Tensorflow and it is built using C++ per the third article, has anything changed at all? I tried looking through the Microsoft.ML and didn't find anything. I also haven't found a more recent article on the discussion. Is there a different way that I can save the TensorFlow model to make it work on x86 in .NET? Is the support for TensorFlow in C# on x86 now available? What are possible workarounds?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Josh
  • 159
  • 2
  • 10
  • With File Explorer check BIN folder of project. When should have to folder 1) x64 2) Debug (for x64) applications. I think you are missing the DEbug folder and need to build project as x64.? – jdweng Feb 28 '22 at 15:43
  • @jdweng I'm not interested in x64 - I can build just fine in 64 bit. I want to build in x86 - 32 bit. I do have the Debug folder inside of bin. – Josh Feb 28 '22 at 17:36
  • The debug folder needs a dll (in the subfolders) and the project must be looking for the x86 dll in the correct subfolder. – jdweng Feb 28 '22 at 17:41
  • @jdweng You're right. The win-x64 folder has a tensorflow.dll file in it and the win-x86 folder does not. I'm not finding a tensorflow.dll for 32 bit readily available online - everything suggests building it yourself. – Josh Feb 28 '22 at 18:17
  • Search for following : github tensorflow x86 – jdweng Feb 28 '22 at 18:46

0 Answers0