How to use tfjs-node with libtensorflow that is bu

2019-07-10 11:24发布

问题:

I see that it is possible to use libtensorflow that is built from source, as mentioned in the README https://github.com/tensorflow/tfjs-node#optional-build-libtensorflow-from-tensorflow-source

I have successfully built from source, but I don't know how to let tfjs-node use this custom built version, instead of the pre-built one.

回答1:

I found that the following workaround seems to work:

Copy the file bazel-bin/tensorflow/libtensorflow.so from the tensorflow source directory to replace node_modules/@tensorflow/tfjs-node/deps/lib/libtensorflow.so inside your project.

Hopefully there is a better way to do npm install such that there is no need to download the pre-compiled version.