Skip to content

Commit

Permalink
[DOCS] Fixed KLDiv example (#126857)
Browse files Browse the repository at this point in the history
Small import fix to make the example run
Pull Request resolved: #126857
Approved by: https://github.com/albanD
  • Loading branch information
elisim authored and pytorchmergebot committed May 24, 2024
1 parent 4105f91 commit 2ac739c
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions torch/nn/modules/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,6 @@ class KLDivLoss(_Loss):
same shape as the input.
Examples::
>>> import torch.nn.functional as F
>>> kl_loss = nn.KLDivLoss(reduction="batchmean")
>>> # input should be a distribution in the log space
>>> input = F.log_softmax(torch.randn(3, 5, requires_grad=True), dim=1)
Expand Down

0 comments on commit 2ac739c

Please sign in to comment.