From 2ac739cc80fe21ec13d24558bdd147f9ae3ea31f Mon Sep 17 00:00:00 2001 From: Eli Simhayev Date: Fri, 24 May 2024 15:39:50 +0000 Subject: [PATCH] [DOCS] Fixed KLDiv example (#126857) Small import fix to make the example run Pull Request resolved: https://github.com/pytorch/pytorch/pull/126857 Approved by: https://github.com/albanD --- torch/nn/modules/loss.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/torch/nn/modules/loss.py b/torch/nn/modules/loss.py index 637e7a7d457e5..75e42303c2703 100644 --- a/torch/nn/modules/loss.py +++ b/torch/nn/modules/loss.py @@ -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)