MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / Net

Class Net

imperative/python/test/unit/utils/test_cgtools.py:106–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105def test_get_opr_seq():
106 class Net(M.Module):
107 def __init__(self):
108 super().__init__()
109 self.data = megengine.tensor(
110 np.random.random((1, 1, 4, 4)), dtype=np.float32
111 )
112
113 def forward(self, input):
114 A = input.shape[0]
115 shape = astensor1d((A, A), self.data, dtype="int32", device=input.device)
116 x = F.reshape(self.data, shape)
117 o = input + x
118 return o
119
120 net = Net()
121 input = megengine.tensor(np.random.random((4, 4)), dtype=np.float32)

Callers 2

test_get_opr_seqFunction · 0.70
test_graph_functionFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_get_opr_seqFunction · 0.56
test_graph_functionFunction · 0.56