【发布时间】:2026-02-08 02:15:02
【问题描述】:
是否可以使用没有标记输入(或输出)节点的 Tensorflow C++ API 来执行图形?据我所知,在训练我的模型时(在 python 中使用 skflow,后来我将其保存为二进制 protobuf),我没有标记输入/输出节点,但我能够恢复模型并毫无困难地进行预测在 Python 中。当使用 C++ API 执行图形时,输入向量是成对的字符串和张量,我假设字符串是指输入节点的标签。来自文档:
Session::Run(const std::vector< std::pair< string, Tensor > > &inputs, const std::vector< string > &output_tensor_names, const std::vector< string > &target_node_names, std::vector< Tensor > *outputs)=0使用提供的输入张量运行图形并填充输出 output_tensor_names 中指定的端点。跑到但没有 返回 target_node_names 中节点的张量。
有什么方法可以在不知道输入/输出节点标签的情况下执行图表?也许有一种方法可以在 Python 中加载图形,给节点标签,然后再次将其保存为 protobuf?理想情况下,我只想传入一个应用于输入节点的向量,而不必担心任何标签。
【问题讨论】:
标签: python c++ machine-learning tensorflow skflow