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

Method test_replace_as_consumer

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

Source from the content-addressed store, hash-verified

356 assert op.inputs[0].name == "T"
357
358 def test_replace_as_consumer(self):
359 net = core.Net("name")
360 net.FC(["X", "W"], ["Y"])
361 nn = ng.NNModule(net)
362 fc = nn.controlFlow[0]
363 test_op = nn.dataFlow.createNode(ng.NeuralNetOperator("TestOp"))
364 nn.replaceAsConsumer(fc, test_op)
365 nn.deleteNode(fc)
366 assert len(nn.controlFlow) == 1
367 assert nn.controlFlow[0].name == "TestOp"
368 assert nn.controlFlow[0].inputs[0].name == "X"
369 assert nn.controlFlow[0].inputs[1].name == "W"
370
371 def test_annotation_basic(self):
372 annot = ng.Annotation()

Callers

nothing calls this directly

Calls 5

replaceAsConsumerMethod · 0.95
deleteNodeMethod · 0.95
NetMethod · 0.80
FCMethod · 0.80
createNodeMethod · 0.80

Tested by

no test coverage detected