MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TF_SessionRun

Function TF_SessionRun

tensorflow/c/c_api.cc:2258–2297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2256}
2257
2258void TF_SessionRun(TF_Session* session, const TF_Buffer* run_options,
2259 const TF_Output* inputs, TF_Tensor* const* input_values,
2260 int ninputs, const TF_Output* outputs,
2261 TF_Tensor** output_values, int noutputs,
2262 const TF_Operation* const* target_opers, int ntargets,
2263 TF_Buffer* run_metadata, TF_Status* status) {
2264 // TODO(josh11b,mrry): Change Session to be able to use a Graph*
2265 // directly, instead of requiring us to serialize to a GraphDef and
2266 // call Session::Extend().
2267 if (session->extend_before_run &&
2268 !ExtendSessionGraphHelper(session, status)) {
2269 return;
2270 }
2271
2272 TF_Run_Setup(noutputs, output_values, status);
2273
2274 // Convert from TF_Output and TF_Tensor to a string and Tensor.
2275 std::vector<std::pair<string, Tensor>> input_pairs(ninputs);
2276 if (!TF_Run_Inputs(input_values, &input_pairs, status)) return;
2277 for (int i = 0; i < ninputs; ++i) {
2278 input_pairs[i].first = OutputName(inputs[i]);
2279 }
2280
2281 // Convert from TF_Output to string names.
2282 std::vector<string> output_names(noutputs);
2283 for (int i = 0; i < noutputs; ++i) {
2284 output_names[i] = OutputName(outputs[i]);
2285 }
2286
2287 // Convert from TF_Operation* to string names.
2288 std::vector<string> target_names(ntargets);
2289 for (int i = 0; i < ntargets; ++i) {
2290 target_names[i] = target_opers[i]->node.name();
2291 }
2292
2293 // Actually run.
2294 TF_Run_Helper(session->session, nullptr, run_options, input_pairs,
2295 output_names, output_values, target_names, run_metadata,
2296 status);
2297}
2298
2299void TF_SessionPRunSetup(TF_Session* session, const TF_Output* inputs,
2300 int ninputs, const TF_Output* outputs, int noutputs,

Callers 6

TF_DequeueNamedTensorFunction · 0.85
TF_EnqueueNamedTensorFunction · 0.85
RunMethod · 0.85
TEST_FFunction · 0.85

Calls 5

ExtendSessionGraphHelperFunction · 0.85
TF_Run_SetupFunction · 0.85
TF_Run_InputsFunction · 0.85
TF_Run_HelperFunction · 0.85
nameMethod · 0.65

Tested by 2

RunMethod · 0.68
TEST_FFunction · 0.68