(self)
| 227 | assert len(nn.controlFlow) == 0 |
| 228 | |
| 229 | def test_replace_subraph(self): |
| 230 | mg = ng.NNMatchGraph() |
| 231 | test2m = mg.createNode(ng.NeuralNetOperator("test2"), strict=True) |
| 232 | xm = mg.createNode(ng.NeuralNetData("X"), strict=True) |
| 233 | testm = mg.createNode(ng.NeuralNetOperator("test")) |
| 234 | mg.createEdge(test2m, xm) |
| 235 | mg.createEdge(xm, testm) |
| 236 | |
| 237 | nn = ng.NNModule() |
| 238 | test2 = nn.dataFlow.createNode(ng.NeuralNetOperator("test2")) |
| 239 | x = nn.dataFlow.createNode(ng.NeuralNetData("X")) |
| 240 | test = nn.dataFlow.createNode(ng.NeuralNetOperator("test")) |
| 241 | nn.dataFlow.createEdge(test2, x) |
| 242 | nn.dataFlow.createEdge(x, test) |
| 243 | |
| 244 | for m in nn.match(mg): |
| 245 | match = m |
| 246 | new_op = nn.dataFlow.createNode(ng.NeuralNetOperator("new_op")) |
| 247 | nn.replaceSubgraph(match, new_op, [], []) |
| 248 | assert len(nn.controlFlow) == 1 |
| 249 | assert nn.controlFlow[0].name == "new_op" |
| 250 | |
| 251 | def test_genericGraph(self): |
| 252 | g = ng.Graph() |
nothing calls this directly
no test coverage detected