在Windows上可以使用TensorFlow C ++ API吗? [英] Is it possible to use TensorFlow C++ API on Windows?

查看:156
本文介绍了在Windows上可以使用TensorFlow C ++ API吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣将TensorFlow集成到Windows 10上的Visual Studio中构建的C ++服务器应用程序中,我需要知道是否有可能. Google最近宣布了Windows对TensorFlow的支持: https ://developers.googleblog.com/2016/11/tensorflow-0-12-adds-support-for-windows.html 但是据我所知,这只是更常用的Python软件包的pip安装,并且要使用C ++ API,您需要自己从来源构建存储库:

I'm interested in incorporating TensorFlow into a C++ server application built in Visual Studio on Windows 10 and I need to know if that's possible. Google recently announced Windows support for TensorFlow: https://developers.googleblog.com/2016/11/tensorflow-0-12-adds-support-for-windows.html but from what I can tell this is just a pip install for the more commonly used Python package, and to use the C++ API you need to build the repo from source yourself: How to build and use Google TensorFlow C++ api I tried building the project myself using bazel, but ran into issues trying to configure the build.

是否有一种方法可以使TensorFlow C ++在本机Windows中工作(不使用Docker或新的Windows 10 Linux子系统,正如我所见过的其他帖子)?

Is there a way to get TensorFlow C++ to work in native Windows (not using Docker or the new Windows 10 Linux subsystem, as I've seen others post about)?

谢谢

伊恩

推荐答案

在Windows上使用TensorFlow的C ++ API当然是可能,但是目前简单不是很容易.现在,在Windows上针对C ++ API进行构建的最简单方法是使用 CMake规则tf_tutorials_example_trainer项目的代码(请参见源代码

It is certainly possible to use TensorFlow's C++ API on Windows, but it is not currently very easy. Right now, the easiest way to build against the C++ API on Windows would be to build with CMake, and adapt the CMake rules for the tf_tutorials_example_trainer project (see the source code here). Building with CMake will give you a Visual Studio project in which you can implement your C++ TensorFlow program.

请注意,tf_tutorials_example_trainer项目构建了一个控制台应用程序,该控制台应用程序将所有TensorFlow运行时静态链接到您的程序中.目前,我们还没有编写必要的规则来创建可重用的TensorFlow DLL,尽管在技术上是可行的:例如,Python扩展是一个包含运行时的DLL,但并未导出使用TensorFlow的C或C ++的必要符号直接使用API​​.

Note that the tf_tutorials_example_trainer project builds a Console Application that statically links all of the TensorFlow runtime into your program. At present we have not written the necessary rules to create a reusable TensorFlow DLL, although this would be technially possible: for example, the Python extension is a DLL that includes the runtime, but does not export the necessary symbols to use TensorFlow's C or C++ APIs directly.

这篇关于在Windows上可以使用TensorFlow C ++ API吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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