-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no head files in cpp builds #30
Comments
標頭檔在7z內include資料夾中 你有辦法使用下面這個連結下載嗎? |
谢谢! |
@fo40225 请问你是用哪个版本的protobuf编译的呢,我试了调用tf训练好的模型,但是编译不通过,提示有6个无法解析的外部符号,全部指向google::protobuf,于是我从https://github.com/google/protobuf下载protobuf,将编译得到的lib加入工程,但这时仍有1个无法解析的外部符号。 |
pip install protobuf==3.4.0 |
@lxgyChen 如果要build出protobuf的lib檔 請使用這個版本
|
@fo40225 ok |
@fo40225 仍然无法使用你编译的c++ api创建图和导入模型:(( |
有具體的錯誤訊息嗎? |
@fo40225 我用的是 VS2017 15.7.6, 我电脑cpu是i7-8750H,显卡是1060,下载的是你编译的tensorflow-1.9-cpp-gpu-avx2, 运行以下代码时是OK的: #define NOMINMAX
#include <iostream>
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/public/session.h"
#include "Eigen/Dense"
#include "tensorflow/core/public/session.h"
#include "tensorflow/cc/ops/standard_ops.h"
using namespace std;
using namespace tensorflow;
int main()
{
Session* session;
Status status = NewSession(SessionOptions(), &session);
if (!status.ok()) {
cout << status.ToString() << "\n";
return 1;
}
cout << "Session successfully created.\n";
cin.get();
return 0;
}
但是运行这段代码就编译有错误: #define NOMINMAX
#include <iostream>
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/public/session.h"
#include "Eigen/Dense"
#include "tensorflow/core/public/session.h"
#include "tensorflow/cc/ops/standard_ops.h"
using namespace std;
using namespace tensorflow;
GraphDef CreateGraphDef()
{
Scope root = Scope::NewRootScope();
auto X = ops::Placeholder(root.WithOpName("x"), DT_FLOAT,
ops::Placeholder::Shape({ -1, 2 }));
auto A = ops::Const(root, { { 3.f, 2.f },{ -1.f, 0.f } });
auto Y = ops::MatMul(root.WithOpName("y"), A, X,
ops::MatMul::TransposeB(true));
GraphDef def;
TF_CHECK_OK(root.ToGraphDef(&def));
return def;
}
int main()
{
std::cout << "me" << std::endl;
GraphDef graph_def = CreateGraphDef();
// Start up the session
SessionOptions options;
std::unique_ptr<Session> session(NewSession(options));
TF_CHECK_OK(session->Create(graph_def));
// Define some data. This needs to be converted to an Eigen Tensor to be
// feed into the placeholder. Note that this will be broken up into two
// separate vectors of length 2: [1, 2] and [3, 4], which will separately
// be multiplied by the matrix.
std::vector<float> data = { 1, 2, 3, 4 };
auto mapped_X_ = Eigen::TensorMap<Eigen::Tensor<float, 2, Eigen::RowMajor>>
(&data[0], 2, 2);
auto eigen_X_ = Eigen::Tensor<float, 2, Eigen::RowMajor>(mapped_X_);
Tensor X_(DT_FLOAT, TensorShape({ 2, 2 }));
X_.tensor<float, 2>() = eigen_X_;
std::vector<Tensor> outputs;
TF_CHECK_OK(session->Run({ { "x", X_ } }, { "y" }, {}, &outputs));
// Get the result and print it out
Tensor Y_ = outputs[0];
std::cout << Y_.tensor<float, 2>() << std::endl;
session->Close();
cin.get();
return 0;
}
提示
|
用libtensorflow-cpu-windows-x86_64-1.8.0-avx2是可以編譯與執行的 大概是1.9.0的cmake有點問題 你先用1.8.0試試 |
這個改動導致 真的需要新版就自己改個create_def_file.py重build吧 官方放棄cmake了 我想我發PR大概也不會被接受 |
1.8版本的的确可以编译运行了:),thank you so much~~(可惜没有cuda9.2-AVX2的版本...) |
Does it mean you will not build Tensorflow 1.10 anymore because they have dropped cmake support?? I guess getting Bazel to work on Windows is still painful right?? Btw thank you for all the wheels you have built. |
@henrysky 1.10 will upload later. I will try to use Banzel to build 1.11, but I can't guarantee multiple configurations like cmake. If no one maintains cmake script, it is possible that 1.10 is the last version. |
@lxgyChen |
@fo40225 I build tensorflow1.9 and 1.10 version's c++ lib successfully, however I cannot build the 1.11 version. It report the lack of |
@fo40225 : Hi downloaded the tensor flow library from the link mentioned above. |
Guys i am getting the same error as mentioned above for building the tensorflow r1.11 with cmake. |
about 1.8.0 cpp file is working well 1.9.0~1.10.0 need to revert tensorflow/tensorflow#19415 and use cmake to rebuild |
@fo40225 : Thanks for the reply. |
@fo40225 : Hi tried downloading the following pre-built library file: libtensorflow-cpu-windows-x86_64-1.8.0-avx2.7z from following location: |
@HackersSpirit Try to add
in the configure page of the project -> C/C++ -> preprocessor -> definition of preprocessor( some name like this because I forget the precise name). |
@MetaPeak : Thanks for the help. Can you please tell exactly at which location the changes have to be made as i am using pre-built binaries along with qt creator. |
@HackersSpirit You can search on google how to add Macro definition on your QT IDE. |
Ohh ok thanks. I misunderstood. I thought i have to add something to any of the given files :) |
Thanks was done. |
Guys @MetaPeak @fo40225 : I tried running both the samples mentioned above and getting the following errors: 1CheckOpMessageBuilder@internal@tensorflow@@qeaa@XZ) referenced in function "class std::basic_string<char,struct std::char_traits,class std::allocator > * __cdecl tensorflow::internal::MakeCheckOpString<__int64,__int64>(__int64 const &,__int64 const &,char const *)" (??$MakeCheckOpString@_J_J@internal@tensorflow@@YAPEAV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@AEB_J0PEBD@Z) |
Could you please put the include files into cpp builds?( :) ) I can't download some files due to the gfw...
The text was updated successfully, but these errors were encountered: