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

Method test_delete_subgraph

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

Source from the content-addressed store, hash-verified

207 assert count == 1
208
209 def test_delete_subgraph(self):
210 mg = ng.NNMatchGraph()
211 test2m = mg.createNode(ng.NeuralNetOperator("test2"), strict=True)
212 xm = mg.createNode(ng.NeuralNetData("X"), strict=True)
213 testm = mg.createNode(ng.NeuralNetOperator("test"))
214 mg.createEdge(test2m, xm)
215 mg.createEdge(xm, testm)
216
217 nn = ng.NNModule()
218 test2 = nn.dataFlow.createNode(ng.NeuralNetOperator("test2"))
219 x = nn.dataFlow.createNode(ng.NeuralNetData("X"))
220 test = nn.dataFlow.createNode(ng.NeuralNetOperator("test"))
221 nn.dataFlow.createEdge(test2, x)
222 nn.dataFlow.createEdge(x, test)
223
224 for m in nn.match(mg):
225 match = m
226 nn.deleteSubgraph(match)
227 assert len(nn.controlFlow) == 0
228
229 def test_replace_subraph(self):
230 mg = ng.NNMatchGraph()

Callers

nothing calls this directly

Calls 4

matchMethod · 0.95
deleteSubgraphMethod · 0.95
createNodeMethod · 0.80
createEdgeMethod · 0.80

Tested by

no test coverage detected