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

Method test_edges_simple

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

Source from the content-addressed store, hash-verified

85 dfg.createNode(7)
86
87 def test_edges_simple(self):
88 nn = ng.NNModule()
89 dfg = nn.dataFlow
90 x = dfg.createNode(ng.NeuralNetData("X"))
91 w = dfg.createNode(ng.NeuralNetData("W"))
92 op = dfg.createNode(ng.NeuralNetOperator("Op"))
93
94 with self.assertRaises(Exception):
95 dfg.createEdge(x, w)
96 dfg.createEdge(op, w)
97 dfg.createEdge(x, op)
98
99 # Dot generation
100 assert(str(dfg).startswith("digraph G"))
101
102 # subgraph
103 sg = ng.NNSubgraph()
104 sg.addNode(x)
105 sg.addNode(op)
106 sg.induceEdges()
107 assert len(sg) == 2
108
109 # subgraph dot generation
110 assert(str(sg).startswith("digraph G"))
111
112 @given(size=st.sampled_from([10, 50]))
113 def test_edges_complex(self, size):

Callers

nothing calls this directly

Calls 3

createNodeMethod · 0.80
assertRaisesMethod · 0.80
createEdgeMethod · 0.80

Tested by

no test coverage detected