TensorFlow.NET icon indicating copy to clipboard operation
TensorFlow.NET copied to clipboard

Tensor.NET can not find a Tensor Backend

Open sang416 opened this issue 1 year ago • 6 comments

Description

using System;
using Tensorflow;
using static Tensorflow.Binding;
using System.Diagnostics;

class TensorEX {
    static void Main() {
        var watch = Stopwatch.StartNew();
        var shape = new int[] { 10000, 10000 };
        var randomMatrix = tf.random.uniform(shape: shape, minval: 0, maxval: 1f);
        var dotOperation = tf.linalg.matmul(randomMatrix, randomMatrix);
        var sumOperation = tf.reduce_sum(dotOperation);
        var result = sumOperation.numpy();
        Console.WriteLine($"Tensor computing result: {result}");
        watch.Stop();
        Console.WriteLine($"Time taken: {watch.ElapsedMilliseconds} ms");
    }
}

dotnet add package TensorFlow.NET dotnet add package TensorFlow.Keras dotnet add package SciSharp.TensorFlow.Redist

My system is running on Mac OS 13.4.1 (Ventura), and even though I've installed all three items mentioned, I'm still getting the message below. I've already installed the Python Tensorflow package and even included the project path in the PATH, but the message still pops up

20230723-162658

sang416 avatar Jul 23 '23 07:07 sang416

Hello, you can refer to #1141. If there still exist some problem, please let me know.

Wanglongzhi2001 avatar Jul 29 '23 03:07 Wanglongzhi2001

Hello @sang416! Do you succeed in solving the issues?

Currently I'm also using Ventura 13.4.1 on M1. Even though I already installed the SciSharp.TensorFlow.Redist-OSX (using nuget), it still brings up the same exception messages.

FuzzyNat26 avatar Aug 18 '23 04:08 FuzzyNat26

Hello @sang416! Do you succeed in solving the issues?

Currently I'm also using Ventura 13.4.1 on M1. Even though I already installed the SciSharp.TensorFlow.Redist-OSX (using nuget), it still brings up the same exception messages.

No, I tried again referring to #1141 above, but it's still not working. Do you happen to know a solution?

sang416 avatar Aug 18 '23 13:08 sang416

Hello @sang416! Do you succeed in solving the issues? Currently I'm also using Ventura 13.4.1 on M1. Even though I already installed the SciSharp.TensorFlow.Redist-OSX (using nuget), it still brings up the same exception messages.

No, I tried again referring to #1141 above, but it's still not working. Do you happen to know a solution?

Nope. As I'm developing for my Unity project, I used Barracuda as the inference library for now. Although, it has its own issues too.

I'll update to this issue if there's any solution that I found 👍

FuzzyNat26 avatar Aug 18 '23 15:08 FuzzyNat26

I've installed the SciSharp.TensorFlow.Redist-OSX package which does indeed add the arm64 libtensorflow*.dylib but it puts them in the runtimes/osx-x64 directory. If you manually move these over to runtimes/osx-arm64 (which I did as a build step) it gets further. However there is something else wrong with the library

Unhandled exception. System.EntryPointNotFoundException: Unable to find an entry point named 'TFC_GetHandleShapeAndType' in shared library 'tensorflow'.

This is at the fit step so it does get through creating the model so it does work somewhat. But this symbol TFC_GetHandleShapeAndType is not in the arm64 library at all (at least searched via strings) but it is in the linux x64 .so file.

infusixllc avatar Oct 01 '23 04:10 infusixllc

Hello! Any news for Apple Silicon?

ByMedion avatar Feb 16 '24 18:02 ByMedion