The training loop
The loop over epochs and batches, computing the loss and updating parameters.
@node-llm/core→src/train/trainer.ts—trainModel
PyTorch → JS mapping
Section titled “PyTorch → JS mapping”| Book (PyTorch) | Here (tfjs) |
|---|---|
loss.backward() + optimizer.step() |
optimizer.minimize(fn, returnCost) |
optimizer.zero_grad() |
handled inside minimize |
| autograd tape | tf.variableGrads / minimize |