【问题标题】:Tensorflow C++ API: Difference between `fetch_outputs` and `run_outputs` in `Session::Run`Tensorflow C++ API:`Session::Run`中`fetch_outputs`和`run_outputs`之间的区别
【发布时间】:2018-04-04 17:25:06
【问题描述】:

TensorFlow 专家您好,

我在 Session::Run 的 C++ API 签名中发现如下

Status Run(
  const RunOptions & run_options,
  const FeedType & inputs,
  const std::vector< Output > & fetch_outputs,
  const std::vector< Operation > & run_outputs,
  std::vector< Tensor > *outputs,
  RunMetadata *run_metadata
) const 

fetch_outputsrun_outputs 有什么区别?根据我目前的理解,run_outputs是运行过程中评估的最终操作节点,fetch_outputs是评估run_outputs时产生的所有中间值。它看起来fetch_outputs 的结果在函数返回时存储到outputs 中。是否也有可能我也得到了run_outputs 的值(或者run_outputs 已包含在outputs 中)?

【问题讨论】:

    标签: c++ tensorflow


    【解决方案1】:

    您的理解大部分是正确的。 fetch_outputs 是张量列表,将在 outputs 中计算并返回。 run_outputs 是我们需要运行的操作列表(例如更新一些变量)但不关心它们的输出。

    我不确定“我是否也有可能获得 run_outputs 的值”是什么意思。如果您想要 run_outputs 中的操作生成的张量,只需将这些张量包含在 fetch_outputs 中。它们不包含在outputs 中——这就是它们的全部目的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-03
      • 2013-04-08
      • 1970-01-01
      • 1970-01-01
      • 2023-02-13
      • 1970-01-01
      • 2013-05-16
      • 1970-01-01
      相关资源
      最近更新 更多