c++ adaptor via emcc for tensorflow.js

I have a moderately large library of C++ code that uses the tensorflow_cc API. I have just started working with Emscripten/emcc and am excited by the potential to port my application to run in node.js using tensorflow.js.

I want to refactor my C++ code so that most of it can be agnostic as to which Tensorflow backend is in use. I expect that this will be done by abstracting Tensor and Model.

Is there already support for this that I have just not yet seen?

Answer

It does not appear that anyone has published an interface like the one I was hoping for, but it is clearly possible to use the emscripten/embind APIs to invoke TensorFlow.js functions from C++.

My first working implementation to do this is available in this gist.

Leave a Reply

Your email address will not be published. Required fields are marked *