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

Class Simple

imperative/python/test/integration/test_grad_detach.py:11–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class Simple(Module):
12 def __init__(self):
13 super().__init__()
14 self.a = Parameter([1.0], dtype=np.float32)
15 self.b = Parameter([1.0], dtype=np.float32)
16
17 def forward(self, x):
18 x = x * self.a
19 x = x.detach() * self.b
20 return x
21
22
23def test_detach():

Callers 1

test_detachFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_detachFunction · 0.56