Skip to content

Commit

Permalink
loss detach (pytorch#731)
Browse files Browse the repository at this point in the history
loss detach
  • Loading branch information
developer0hye committed Apr 11, 2020
1 parent 80fcb66 commit 391be73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imagenet/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def train(train_loader, model, criterion, optimizer, epoch, args):

# measure accuracy and record loss
acc1, acc5 = accuracy(output, target, topk=(1, 5))
losses.update(loss.item(), images.size(0))
losses.update(loss.detach().item(), images.size(0))
top1.update(acc1[0], images.size(0))
top5.update(acc5[0], images.size(0))

Expand Down

0 comments on commit 391be73

Please sign in to comment.