(x)
| 35 | |
| 36 | @partial(mx.compile, inputs=state, outputs=state) |
| 37 | def step(x): |
| 38 | loss_and_grad_fn = nn.value_and_grad(model, loss_fn) |
| 39 | loss, grads = loss_and_grad_fn(model, x) |
| 40 | optimizer.update(model, grads) |
| 41 | return loss |
| 42 | |
| 43 | with trange(args.n_steps) as steps: |
| 44 | for it in steps: |