(model, optimizer, timage, tlabel)
| 73 | label = np.random.randint(0, 10, (3, 8,)) |
| 74 | |
| 75 | def func(model, optimizer, timage, tlabel): |
| 76 | with gm: |
| 77 | score = model(timage) |
| 78 | loss = F.nn.cross_entropy(score, tlabel) |
| 79 | gm.backward(loss) |
| 80 | optimizer.step().clear_grad() |
| 81 | return loss |
| 82 | |
| 83 | if is_trace: |
| 84 | func = xla_trace(func, without_host=True, capture_as_const=True) |
no test coverage detected