nikhilk / node-tensorflow

Node.js + TensorFlow
Apache License 2.0
587 stars 59 forks source link

Improve node.js <-> tensorflow interop implementation #2

Open nikhilk opened 8 years ago

nikhilk commented 8 years ago

I chose the ffi node module to focus on the bigger picture.

It should be pretty straightforward however to use node-gyp and create a custom binding layer for exposing TensorFlow functionality into node.js -- effectively recreate, so its not going through generic layers and incurring overhead.

However, the interesting question is what is the overhead and does it matter? Need to determine that before taking this on, when enough stuff works, and it can be considered.

peterbraden commented 8 years ago

I would suggest using SWIG to create a native binding?

This is what is suggested on the Tensorflow API page https://www.tensorflow.org/versions/0.6.0/api_docs/index.html

aahutsal commented 7 years ago

@peterbraden and @nikhilk I might be interested in reworking this project with native bindings. Is #SWIG something like #JNI for Java? and... Could you please gimme some good resources about #SWIG to read?

nikhilk commented 6 years ago

As far as I know SWIG is a python thing (though I might be wrong). Node.js has its own support for building native modules, which doesn't rely on SWIG (again, as far as I know).

For me the interesting thing is the performance of session.run and marshalling of Tensor data. That would be where performance becomes interesting. Still need to understand the overhead of ffi.

In the meantime, did a significant update of implementation.