如何将 tfjs-node 与从源代码构建的 libtensorflow 一起使用 [英] How to use tfjs-node with libtensorflow that is built from source

查看:46
本文介绍了如何将 tfjs-node 与从源代码构建的 libtensorflow 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到可以使用从源代码构建的 libtensorflow,如自述文件中所述https://github.com/tensorflow/tfjs-node#optional-build-libtensorflow-from-tensorflow-source

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

我已经成功地从源代码构建,但我不知道如何让 tfjs-node 使用这个自定义构建的版本,而不是预构建的版本.

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.

推荐答案

我发现以下解决方法似乎有效:

I found that the following workaround seems to work:

从tensorflow源码目录复制bazel-bin/tensorflow/libtensorflow.so文件,替换node_modules/@tensorflow/tfjs-node/deps/lib/libtensorflow.so代码>在您的项目中.

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.

希望有更好的方法来执行 npm install,这样就无需下载预编译版本.

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

这篇关于如何将 tfjs-node 与从源代码构建的 libtensorflow 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆