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

Method Subgraph

tensorflow/core/graph/subgraph_test.cc:107–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105 }
106
107 string Subgraph(const string& fed_str, const string& fetch_str,
108 const string& targets_str,
109 bool use_function_convention = false) {
110 Graph* subgraph = new Graph(OpRegistry::Global());
111 CopyGraph(*g_, subgraph);
112 std::vector<string> fed =
113 str_util::Split(fed_str, ',', str_util::SkipEmpty());
114 std::vector<string> fetch =
115 str_util::Split(fetch_str, ',', str_util::SkipEmpty());
116 std::vector<string> targets =
117 str_util::Split(targets_str, ',', str_util::SkipEmpty());
118
119 subgraph::RewriteGraphMetadata metadata;
120 Status s = subgraph::RewriteGraphForExecution(
121 subgraph, fed, fetch, targets, device_info_, use_function_convention,
122 &metadata);
123 if (!s.ok()) {
124 delete subgraph;
125 return s.ToString();
126 }
127
128 EXPECT_EQ(fed.size(), metadata.feed_types.size());
129 EXPECT_EQ(fetch.size(), metadata.fetch_types.size());
130
131 // Replace the graph with the subgraph for the rest of the display program
132 g_.reset(subgraph);
133 return "OK";
134 }
135
136 Graph* graph() { return g_.get(); }
137

Callers

nothing calls this directly

Calls 8

SkipEmptyClass · 0.85
RewriteGraphForExecutionFunction · 0.85
CopyGraphFunction · 0.70
SplitFunction · 0.50
okMethod · 0.45
ToStringMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected