Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
[Bug Fix] trainer.update(1) should be used after loss.mean() is called
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzh47 committed Nov 12, 2019
1 parent 61ec270 commit e502764
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/sentiment_analysis/sentiment_analysis_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def train(net, train_data, test_data, dev_data=None):
L = loss(output, label).mean()
L.backward()
# Update parameter.
trainer.step(args.batch_size)
trainer.step(1)
log_interval_L += L.asscalar()
epoch_L += L.asscalar()
if (i + 1) % args.log_interval == 0:
Expand Down

0 comments on commit e502764

Please sign in to comment.