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

Function trace_func

imperative/python/test/unit/xla/test_xla_trace.py:152–157  ·  view source on GitHub ↗
(model, inp1, inp2, scale_factor)

Source from the content-addressed store, hash-verified

150
151 @xla_trace(without_host=True)
152 def trace_func(model, inp1, inp2, scale_factor):
153 gm.attach([inp1, inp2])
154 with gm:
155 loss = model(inp1, inp2)
156 scaler.backward(gm, scale_factor, loss)
157 return [inp1.grad, scale_factor]
158
159 mge_rsts = trace_func(test_module, x, y, scaler.scale_factor)
160 xla_rsts = trace_func(test_module, x, y, scaler.scale_factor)

Callers 1

testerFunction · 0.85

Calls 3

modelFunction · 0.85
attachMethod · 0.45
backwardMethod · 0.45

Tested by

no test coverage detected