in source/neuropod/backends/tensorflow/saved_model/loader.cc [151:185]
Status RunOnce(const RunOptions & run_options,
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,
RunMetadata * run_metadata,
Session * session)
{
CallableOptions callable_options;
std::vector<Tensor> feed_tensors;
*callable_options.mutable_run_options() = run_options;
for (const auto &input : inputs)
{
const string &name = input.first;
const Tensor &tensor = input.second;
callable_options.add_feed(name);
feed_tensors.push_back(tensor);
}
for (const string &output_tensor_name : output_tensor_names)
{
callable_options.add_fetch(output_tensor_name);
}
for (const string &target_node_name : target_node_names)
{
callable_options.add_target(target_node_name);
}
Session::CallableHandle callable_handle;
TF_RETURN_IF_ERROR(session->MakeCallable(callable_options, &callable_handle));
const Status run_status = session->RunCallable(callable_handle, feed_tensors, outputs, run_metadata);
// Be sure to call ReleaseCallable() regardless of the outcome of
// RunCallable().
session->ReleaseCallable(callable_handle).IgnoreError();
return run_status;
}