gpt4 book ai didi

c++ - 通过c++ tensorflow接口(interface)获取模型的输入输出节点信息

转载 作者:行者123 更新时间:2023-12-02 10:22:42 25 4
gpt4 key购买 nike

以下代码在 tensorflow 1.13.1 下编译失败:

GraphDef graph_def;
status = ReadBinaryProto(Env::Default(), modelPath, &graph_def);
if (!status.ok()) {
std::cerr << "ReadBinaryProto Status:" << status.ToString() << endl;
return -1;
}
cout << "success." << endl;
int a = graph_def.node_size();

int i;
for (i = 0; i < a; i++)
{
graph_def.node(i).PrintDebugString();
}
return -1;

编译错误信息

Unresolved external symbol "public: class google::protobuf::internal::LogMessage & __cdecl google::protobuf::internal::LogMessage::operator<<(char const *)" (??6LogMessage@internal@protobuf@google@@QEAAAEAV0123@PEBD@Z)
Unresolved external symbol "public: void __cdecl google::protobuf::internal::LogFinisher::operator=(class google::protobuf::internal::LogMessage &)" (??4LogFinisher@internal@protobuf@google@@QEAAXAEAVLogMessage@123@@Z)
Unresolved external symbol "public: void __cdecl google::protobuf::Message::PrintDebugString(void)const " (?PrintDebugString@Message@protobuf@google@@QEBAXXZ)
Unresolved external symbol "public: __cdecl google::protobuf::internal::LogMessage::LogMessage(enum google::protobuf::LogLevel,char const *,int)" (??0LogMessage@internal@protobuf@google@@QEAA@W4LogLevel@23@PEBDH@Z)
Unresolved external symbol "public: __cdecl google::protobuf::internal::LogMessage::~LogMessage(void)" (??1LogMessage@internal@protobuf@google@@QEAA@XZ)



以上所有操作都出现在visual studio 2015下。

最佳答案

将编译错误消息中建议的代码添加到链接中文件的末尾。
需要修改的文件链接:
https://github.com/guikarist/tensorflow-windows-build-script/blob/master/patches/tf_exported_symbols_msvc.lds
**enter image description here**

然后重新编译 tensorflow 。
整个编译过程引用以下链接。
https://blog.csdn.net/atpalain_csdn/article/details/97945536

关于c++ - 通过c++ tensorflow接口(interface)获取模型的输入输出节点信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59405886/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com