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

Function train_func

imperative/python/test/integration/test_dtr.py:111–117  ·  view source on GitHub ↗
(data, label, *, net, gm)

Source from the content-addressed store, hash-verified

109 gm = GradManager().attach(resnet1202.parameters())
110
111 def train_func(data, label, *, net, gm):
112 net.train()
113 with gm:
114 pred = net(data)
115 loss = F.loss.cross_entropy(pred, label)
116 gm.backward(loss)
117 return pred, loss
118
119 _, free_mem = mge.device.get_mem_status_bytes()
120 tensor_mem = free_mem - (2 ** 30)

Callers 1

run_dtr_resnet1202Function · 0.70

Calls 2

trainMethod · 0.45
backwardMethod · 0.45

Tested by

no test coverage detected