(model, inp1, inp2, scale_factor)
| 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) |