We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcb1e23 commit 2959775Copy full SHA for 2959775
example/train.py
@@ -50,13 +50,13 @@
50
# first forward-backward step
51
enable_running_stats(model)
52
predictions = model(inputs)
53
- loss = smooth_crossentropy(predictions, targets)
+ loss = smooth_crossentropy(predictions, targets, smoothing=args.label_smoothing)
54
loss.mean().backward()
55
optimizer.first_step(zero_grad=True)
56
57
# second forward-backward step
58
disable_running_stats(model)
59
- smooth_crossentropy(model(inputs), targets).mean().backward()
+ smooth_crossentropy(model(inputs), targets, smoothing=args.label_smoothing).mean().backward()
60
optimizer.second_step(zero_grad=True)
61
62
with torch.no_grad():
0 commit comments