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

Function train_fun

imperative/python/test/integration/test_trace_dump.py:69–75  ·  view source on GitHub ↗
(data, label)

Source from the content-addressed store, hash-verified

67
68 @trace
69 def train_fun(data, label):
70 with gm:
71 net.train()
72 pred = net(data)
73 loss = F.nn.cross_entropy(pred, label)
74 gm.backward(loss)
75 return pred, loss
76
77 @trace
78 def val_fun(data, label):

Callers 1

test_xornet_trace_dumpFunction · 0.70

Calls 2

trainMethod · 0.45
backwardMethod · 0.45

Tested by

no test coverage detected