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

Function RewriteGraphForExecution

tensorflow/core/graph/subgraph.cc:294–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294Status RewriteGraphForExecution(
295 Graph* g, const gtl::ArraySlice<string>& fed_outputs,
296 const gtl::ArraySlice<string>& fetch_outputs,
297 const gtl::ArraySlice<string>& target_node_names,
298 const DeviceAttributes& device_info, bool use_function_convention,
299 RewriteGraphMetadata* out_metadata) {
300 std::vector<std::unique_ptr<PruneRewrite>> feed_rewrites;
301 feed_rewrites.reserve(fed_outputs.size());
302 if (use_function_convention) {
303 for (size_t i = 0; i < fed_outputs.size(); ++i) {
304 feed_rewrites.emplace_back(new ArgFeedRewrite(
305 &fed_outputs[i], &device_info, static_cast<int32>(i)));
306 }
307 } else {
308 for (const string& fed_output : fed_outputs) {
309 feed_rewrites.emplace_back(
310 new RecvFeedRewrite(&fed_output, &device_info));
311 }
312 }
313
314 std::vector<std::unique_ptr<PruneRewrite>> fetch_rewrites;
315 fetch_rewrites.reserve(fetch_outputs.size());
316 if (use_function_convention) {
317 for (size_t i = 0; i < fetch_outputs.size(); ++i) {
318 fetch_rewrites.emplace_back(new RetvalFetchRewrite(
319 &fetch_outputs[i], &device_info, static_cast<int32>(i)));
320 }
321 } else {
322 for (const string& fetch_output : fetch_outputs) {
323 fetch_rewrites.emplace_back(
324 new SendFetchRewrite(&fetch_output, &device_info));
325 }
326 }
327
328 return RewriteGraphForExecution(g, feed_rewrites, fetch_rewrites,
329 target_node_names, out_metadata);
330}
331
332namespace {
333template <typename StringContainer>

Callers 5

FoldConstantsFunction · 0.85
RunMethod · 0.85
PruneGraphMethod · 0.85
SubgraphMethod · 0.85
BM_SubgraphHelperFunction · 0.85

Calls 13

InvalidArgumentFunction · 0.85
FeedInputsFunction · 0.85
FetchOutputsFunction · 0.85
PruneForTargetsFunction · 0.85
nameMethod · 0.65
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
emptyMethod · 0.45
insertMethod · 0.45
countMethod · 0.45
num_nodesMethod · 0.45

Tested by 2

SubgraphMethod · 0.68
BM_SubgraphHelperFunction · 0.68