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

Function train_fn

imperative/python/test/integration/test_bn.py:39–45  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

37 data = np.random.random((6, nchannel, 2, 2)).astype("float32")
38
39 def train_fn(d):
40 for _ in range(3):
41 with gm:
42 loss = m(d).mean()
43 gm.backward(loss)
44 optim.step()
45 return loss
46
47 if use_trace:
48 train_fn = trace(train_fn, symbolic=use_symbolic)

Callers 1

run_frozen_bnFunction · 0.85

Calls 3

meanMethod · 0.45
backwardMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected