(data, label, net, opt, gm)
| 81 | |
| 82 | |
| 83 | def train(data, label, net, opt, gm): |
| 84 | opt.clear_grad() |
| 85 | with gm: |
| 86 | pred = net(data) |
| 87 | loss = F.nn.cross_entropy(pred, label) |
| 88 | gm.backward(loss) |
| 89 | opt.step() |
| 90 | return loss |
| 91 | |
| 92 | |
| 93 | def update_model(model_path): |
no test coverage detected