skip to content
promptdojo
_
[ save your spot ]
[ follow on x ]
Autograd as a dependency graph — step 2 of 7
ch 42 · pytorch tensors and autograd
2/7
promptdojo
_
›
phase 08 · ai/ml engineering buildout
›
ch 42 · pytorch tensors and autograd
lesson 3 of 4 · autograd as a dependency graph
step 2 / 7
In a training loop, what does
loss.backward()
actually do?
1
It computes the gradient of the loss for each parameter and stores it (e.g. in w.grad).
2
It updates the parameters to their new values.
3
It runs the model forward to produce the prediction.
4
It lowers the loss directly by editing the data.
check
Show hint
Autograd as a dependency graph — step 2 of 7
ch 42 · pytorch tensors and autograd
2/7
promptdojo
_
›
phase 08 · ai/ml engineering buildout
›
ch 42 · pytorch tensors and autograd
lesson 3 of 4 · autograd as a dependency graph
step 2 / 7
In a training loop, what does
loss.backward()
actually do?
1
It computes the gradient of the loss for each parameter and stores it (e.g. in w.grad).
2
It updates the parameters to their new values.
3
It runs the model forward to produce the prediction.
4
It lowers the loss directly by editing the data.
check
Show hint
park a thought