Browse Source

feat: add check for redist backend.

tags/v0.110.0-LSTM-Model
Yaohui Liu 2 years ago
parent
commit
9ce5b29bff
No known key found for this signature in database GPG Key ID: E86D01E1809BD23E
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      src/TensorFlowNET.Core/APIs/c_api.cs

+ 15
- 0
src/TensorFlowNET.Core/APIs/c_api.cs View File

@@ -45,6 +45,21 @@ namespace Tensorflow
{
public const string TensorFlowLibName = "tensorflow";

static c_api()
{
try
{
var handle = TF_Version();
}
catch (DllNotFoundException)
{
throw new RuntimeError("Tensorflow.NET cannot find a backend. Please install one of the following packages for your program: " +
"SciSharp.TensorFlow.Redist, SciSharp.TensorFlow.Redist-Linux-GPU, SciSharp.TensorFlow.Redist-Windows-GPU. For more details, " +
"please visit https://github.com/SciSharp/TensorFlow.NET. If it still not work after installing the backend, please submit an " +
"issue to https://github.com/SciSharp/TensorFlow.NET/issues");
}
}

public static string StringPiece(IntPtr handle)
{
return handle == IntPtr.Zero ? String.Empty : Marshal.PtrToStringAnsi(handle);


Loading…
Cancel
Save