Skip to content

Commit

Permalink
use both result for backward
Browse files Browse the repository at this point in the history
  • Loading branch information
jojonki committed Dec 10, 2017
1 parent df88fec commit 9c10a1f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ def train(model, data, optimizer, ema, n_epoch=30, start_epoch=0, batch_size=arg
logger.histo_summary(name + '/grad', to_np(param.grad), step)

optimizer.zero_grad()
# (loss_p1+loss_p2).backward()
loss_p1.backward()
(loss_p1+loss_p2).backward()
optimizer.step()
for name, param in model.named_parameters():
if param.requires_grad:
Expand Down

0 comments on commit 9c10a1f

Please sign in to comment.