Skip to content

Commit 2bdcb35

Browse files
author
Svetlana Karslioglu
authored
Merge branch 'main' into fix-lenet-dims
2 parents faa58f8 + 327f259 commit 2bdcb35

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

beginner_source/basics/optimization_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def train_loop(dataloader, model, loss_fn, optimizer):
160160
optimizer.step()
161161

162162
if batch % 100 == 0:
163-
loss, current = loss.item(), batch * len(X)
163+
loss, current = loss.item(), (batch + 1) * len(X)
164164
print(f"loss: {loss:>7f} [{current:>5d}/{size:>5d}]")
165165

166166

beginner_source/basics/quickstart_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def train(dataloader, model, loss_fn, optimizer):
151151
optimizer.step()
152152

153153
if batch % 100 == 0:
154-
loss, current = loss.item(), batch * len(X)
154+
loss, current = loss.item(), (batch + 1) * len(X)
155155
print(f"loss: {loss:>7f} [{current:>5d}/{size:>5d}]")
156156

157157
##############################################################################

0 commit comments

Comments
 (0)