Am I wrong? demo.pyinb Input[7] didn't update total_loss.data after the last learning.
- Dominant language
- Jupyter Notebook
- Stars
- 17.6k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
# optimization
for k in range(100):
# forward
total_loss, acc = loss()
# backward
model.zero_grad()
total_loss.backward()
# update (sgd)
learning_rate = 1.0 - 0.9*k/100
for p in model.parameters():
p.data -= learning_rate * p.grad
if k % 1 == 0:
# should it add a new line here?
# total_loss, acc = loss()
print(f"step {k} loss {total_loss.data}, accuracy {acc*100}%")
Contributor guide
No contributing guide indexed for this repository
Research direction
Open demo.pyinb at Input[7] and trace when total_loss is computed relative to the parameter update in the loop. Compare the printed total_loss with a fresh loss evaluation after the update; done means the notebook’s behavior and expected output are clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100