MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_match_graph

Method test_match_graph

caffe2/python/nomnigraph_test.py:187–207  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

185 assert count == 1
186
187 def test_match_graph(self):
188 mg = ng.NNMatchGraph()
189 test2m = mg.createNode(ng.NeuralNetOperator("test2"), strict=True)
190 xm = mg.createNode(ng.NeuralNetData("X"), strict=True)
191 testm = mg.createNode(ng.NeuralNetOperator("test"))
192 mg.createEdge(test2m, xm)
193 mg.createEdge(xm, testm)
194
195 nn = ng.NNModule()
196 test2 = nn.dataFlow.createNode(ng.NeuralNetOperator("test2"))
197 x = nn.dataFlow.createNode(ng.NeuralNetData("X"))
198 test = nn.dataFlow.createNode(ng.NeuralNetOperator("test"))
199 nn.dataFlow.createEdge(test2, x)
200 nn.dataFlow.createEdge(x, test)
201
202 count = 0
203 for match in nn.match(mg):
204 print(len(match))
205 assert len(match) == 3
206 count += 1
207 assert count == 1
208
209 def test_delete_subgraph(self):
210 mg = ng.NNMatchGraph()

Callers

nothing calls this directly

Calls 3

matchMethod · 0.95
createNodeMethod · 0.80
createEdgeMethod · 0.80

Tested by

no test coverage detected