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

Method TestGraphs

tensorflow/core/grappler/graph_analyzer/test_tools.cc:149–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149TestGraphs::TestGraphs() {
150 {
151 GraphDef& graph = graph_3n_self_control_;
152 // The topology includes a loop and a link to self.
153 (*graph.add_node()) = MakeNodeConst("node1");
154 (*graph.add_node()) = MakeNodeSub("node2", "node3:1", "node3:0");
155 auto node3 = graph.add_node();
156 *node3 = MakeNodeBroadcastGradientArgs("node3", "node1", "node2");
157 node3->add_input("^node3"); // The control link goes back to self.
158 }
159 {
160 GraphDef& graph = graph_multi_input_;
161 // The topology includes a loop and a link to self.
162 (*graph.add_node()) = MakeNodeConst("const1_1");
163 (*graph.add_node()) = MakeNodeConst("const1_2");
164 (*graph.add_node()) = MakeNodeAddN("add1", "const1_1", "const1_2");
165
166 (*graph.add_node()) = MakeNodeConst("const2_1");
167 (*graph.add_node()) = MakeNodeConst("const2_2");
168 (*graph.add_node()) = MakeNodeConst("const2_3");
169
170 auto add2 = graph.add_node();
171 *add2 = MakeNodeAddN("add2", "const2_1", "const2_2");
172 // The 3rd node is connected twice, to 4 links total.
173 add2->add_input("const2_3");
174 add2->add_input("const2_3");
175
176 (*graph.add_node()) = MakeNodeSub("sub", "add1", "add2");
177 }
178 {
179 GraphDef& graph = graph_all_or_none_;
180 // The topology includes a loop and a link to self.
181 (*graph.add_node()) = MakeNodeConst("const1_1");
182 (*graph.add_node()) = MakeNodeConst("const1_2");
183 auto pass1 = graph.add_node();
184 *pass1 = MakeNodeIdentityN("pass1", "const1_1", "const1_2");
185
186 (*graph.add_node()) = MakeNodeConst("const2_1");
187 (*graph.add_node()) = MakeNodeConst("const2_2");
188 (*graph.add_node()) = MakeNodeConst("const2_3");
189
190 auto pass2 = graph.add_node();
191 *pass2 = MakeNodeIdentityN("pass2", "const2_1", "const2_2");
192 // The 3rd node is connected twice, to 4 links total.
193 pass2->add_input("const2_3");
194 pass2->add_input("const2_3");
195
196 // Add the control links, they get handled separately than the normal
197 // links.
198 pass1->add_input("^const2_1");
199 pass1->add_input("^const2_2");
200 pass1->add_input("^const2_3");
201
202 (*graph.add_node()) = MakeNodeSub("sub", "pass1", "pass2");
203 }
204 {
205 GraphDef& graph = graph_circular_onedir_;
206 (*graph.add_node()) = MakeNodeMul("node1", "node5", "node5");

Callers

nothing calls this directly

Calls 7

MakeNodeConstFunction · 0.85
MakeNodeSubFunction · 0.85
MakeNodeAddNFunction · 0.85
MakeNodeIdentityNFunction · 0.85
MakeNodeMulFunction · 0.85
add_inputMethod · 0.45

Tested by

no test coverage detected