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

FFI backend #90

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

FFI backend #90

wants to merge 3 commits into from

Conversation

headius
Copy link

@headius headius commented Jun 9, 2017

This is for #89.

I have taken the approach of simply swapping the FFI bindings in for the ext bindings and replacing any C wrappers around the TensorFlow API with Ruby+FFI versions of the same code.

So far things are working ok, but I'm stuck with a segfault (0x00 mem access) that I can't figure out. A call to TF_SetAttrTensor with a tensor created by the wrapper String_encoder method seems to be improperly initialized, later blowing up somewhere near Status::SlowCopyFrom in TensorFlow itself via a 0x0 pointer access.

There's also a small tweak to the generated code to modify the TF_StringEncode binding to have an out parameter for the destination. This will need some tweaks to ffi_gen to avoid, and there are likely other cases.

The segv I get is here...maybe someone will be able to help: https://gist.github.com/headius/752eb916bd3a9d39f2574a5a5f06d1f5

Obviously a lot more work to do here but I'm pleased with how far I got.

@arafatkatze arafatkatze self-assigned this Jun 11, 2017
@arafatkatze
Copy link
Collaborator

@headius Thanks a lot for doing this.
I will look at this tomorrow and see if I come up with something.
I have faced the exact same issue that you are referring to and it bugged me a lot so I will try to see it.

Thanks again, This is cool.

@pavel-jurasek
Copy link

I will look at that

@nusco
Copy link

nusco commented Dec 27, 2018

Any news on this? It's a pity that this project is falling back, and FFI seems like the way forward.

@illtellyoulater
Copy link

Or maybe this is the way to go?

TensorStream, a pure ruby machine learning framework (with OpenCL support) based on TensorFlow.

https://github.com/jedld/tensor_stream

https://medium.com/@joseph.dayo/tensorstream-bringing-machine-learning-to-ruby-114582060e3d

@arafatkatze arafatkatze removed their assignment Jan 14, 2021
@headius
Copy link
Author

headius commented Jan 14, 2021

TensorStream, a pure ruby machine learning framework (with OpenCL support) based on TensorFlow.

I never noticed this comment but I wanted to point out that TensorStream is not actually wrapping TensorFlow like this library does, and only supports the OpenCL backend on CRuby anyway (pure-Ruby on other impls).

@akostadinov
Copy link

How about https://github.com/ankane/tensorflow-ruby ?

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

Successfully merging this pull request may close these issues.

6 participants