(x)
| 163 | opt = optimizer.SGD(net.parameters(), 1e-3) |
| 164 | |
| 165 | def train_func(x): |
| 166 | with gm: |
| 167 | y = net(x) |
| 168 | loss = y.mean() |
| 169 | gm.backward(loss) |
| 170 | opt.step().clear_grad() |
| 171 | return loss |
| 172 | |
| 173 | if trace_mode is not None: |
| 174 | train_func = trace(train_func, symbolic=trace_mode) |
no test coverage detected