I'm new to C# and I've been researching this error for a long time.
I wanted to use my trained TensorFlow model with Tensorflowsharp in Visual Studio for Mac so I created a .NET console project and installed TensorflowSharp 1.13.0 from nuget.org using the built-in package manager.
However, when I included the following code in Program.cs
using System;
using TensorFlow;
namespace ai
{
class MainClass
{
public static void Main(string[] args)
{
var graph = new TFGraph();
}
}
}
I got this error message:
Unhandled Exception:
System.DllNotFoundException: libtensorflow
at (wrapper managed-to-native) TensorFlow.TFGraph.TF_NewGraph()
at TensorFlow.TFGraph..ctor () [0x00022] in <a8cd6d02fde04a81817b4f25d24a7be9>:0
According to some of the posts that I found, this might states that libtensorflow.dylib
is not in bin/Debug/
directory, but when I looked into it I found the file inside.
What am I doing wrong?
My environment setup:
Thank you so much for any help!
Try change to 64 bit.
This may not correct answer to you. But give a try. I dont have mac environment. But I tried woth .net core and TensorflowSharp and it works fine. Same time I tried with .net framework and I also got dll not found issue and BadImageFormatException.
https://github.com/migueldeicaza/TensorFlowSharp/issues/103 https://github.com/migueldeicaza/TensorFlowSharp/issues/103