Skip to content

Commit 9ce5b29

Browse files
committed
feat: add check for redist backend.
1 parent b26c37a commit 9ce5b29

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/TensorFlowNET.Core/APIs/c_api.cs

+15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ public partial class c_api
4545
{
4646
public const string TensorFlowLibName = "tensorflow";
4747

48+
static c_api()
49+
{
50+
try
51+
{
52+
var handle = TF_Version();
53+
}
54+
catch (DllNotFoundException)
55+
{
56+
throw new RuntimeError("Tensorflow.NET cannot find a backend. Please install one of the following packages for your program: " +
57+
"SciSharp.TensorFlow.Redist, SciSharp.TensorFlow.Redist-Linux-GPU, SciSharp.TensorFlow.Redist-Windows-GPU. For more details, " +
58+
"please visit https://github.com/SciSharp/TensorFlow.NET. If it still not work after installing the backend, please submit an " +
59+
"issue to https://github.com/SciSharp/TensorFlow.NET/issues");
60+
}
61+
}
62+
4863
public static string StringPiece(IntPtr handle)
4964
{
5065
return handle == IntPtr.Zero ? String.Empty : Marshal.PtrToStringAnsi(handle);

0 commit comments

Comments
 (0)