Gan*_*M S 1 c++ c++11 tensorflow
使用c ++加载“ .pb”模型后,
如何使用tensorflow库使用c ++获取名称值(即add&output_TT)。
.pb文件中的图层如下:
node {
name: "add"
op: "Add"
input: "MatMul"
input: "bias/read"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
}
node {
name: "output_TT"
op: "Softmax"
input: "add"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
}
Run Code Online (Sandbox Code Playgroud)
我没有使用bazel来构建;相反,我执行了一些自定义的内置makefile文件。
我按照以下步骤得到了输出,
int node_count = graph_def.node_size();
for (int i = 0; i < node_count; i++)
{
auto n = graph_def.node(i);
cout<<"Names : "<< n.name() <<endl;
}
Run Code Online (Sandbox Code Playgroud)