Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mobile compatibility (Similar to issue #37) #43

Open
SimonIgnat opened this issue Mar 8, 2017 · 4 comments
Open

mobile compatibility (Similar to issue #37) #43

SimonIgnat opened this issue Mar 8, 2017 · 4 comments

Comments

@SimonIgnat
Copy link

Hi Miguel,

I'm trying to get a reference to TensorFlowSharp in my Xamarin mobile development but I'm experiencing some issues.

The problem is that TensorFlowSharp doesn't build when targeting MONO / .NET 4.5, which is necessary to reference it in the mobile project.

Build error arises at line 675 since MemoryCopy was first introduced in .NET 4.6
Buffer.MemoryCopy ((void*)src, target, size, size);

Do you know any workaround to this?

Best regards,
Simon

@migueldeicaza
Copy link
Owner

You would need to rebuild the library for mobile. I have not done any work in that area, you will likely just have to replicate the .csproj that I have for desktop.

@DumDumin
Copy link

Hi guys,

I am trying to use TensorFlowSharp in a Xamarin.Android application, but I am having trouble getting it done.

  • First of all I got it running in a .net 4.6.1 application with the nuget package. So the basic setup work :)
  • Next step I tried was just adding the nuget package to the Xamarin.Android project, but the TensorFlowSharp.dll was not added to the references. Like you mentioned in the README, because its no .net 4.6.1 project probably...
  • Then I just added the reference by myself :D and got an DLLNotFoundException on runtime (sadly there is no more info than that statement)
  • Next, I rebuild your API in a Xamarin.Android Classlibrary (like miguel suggested in Xamarin mobile compatibility #37), but it ends up in the same exception...

=> I hope you guys can give me a hint on what I am missing (Or what my false assumption are). Do I have to get a different file for the "libtensorflow"? Your nuget package provides a .dll a .dylib and a .so file. My knowledge so far is, that the .so file can be used by android as a library.

@gmlwns2000
Copy link

I tried to run TensorFlowSharp on Xamarin.Forms application, too.
So I ported project already for Xamarin.

As far as I know, to use .so files on Xamarin.Android you should add .so files on Xamarin.Android project as EmbadedNativeLibrary or AndroidNativeLibrary
Xamarin Manual: Using Native Bindings

And this is my work.
https://github.com/gmlwns2000/TensorFlowSharp

I hope this will help you.
And also, if guys find some wrong in my work, please give me some advice!

@ghost
Copy link

ghost commented Mar 1, 2018

This is kind of going against how this project is evolving but I thought I'd mention it anyway.

Tensorflow has a single Java class file that can be called to interact with Tensorflow on Android. A Jar (containing this class file) and required native binaries for Android (.so) can be found here, for instance. You can then actually create a Xamarin Android bindings library against this Jar (making sure to include the native binaries for each architecture) and then call it from C# in Xamarin.Android. I have done this successfully in another project. Would creating an idiomatic Bindings library for Tensorflow Mobile (Android at least) be something you'd be interested in @migueldeicaza ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants