-
Notifications
You must be signed in to change notification settings - Fork 63
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
base: master
Are you sure you want to change the base?
FFI backend #90
Conversation
This does not quite run yet but gets to the point of crashing while attempting to set a Tensor attribute.
@headius Thanks a lot for doing this. Thanks again, This is cool. |
I will look at that |
Any news on this? It's a pity that this project is falling back, and FFI seems like the way forward. |
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 |
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). |
How about https://github.com/ankane/tensorflow-ruby ? |
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.