Fixed text of error message in case of unexpected target size (#6617)

diff --git a/torch/nn/functional.py b/torch/nn/functional.py
index d6104f5..1084da3 100644
--- a/torch/nn/functional.py
+++ b/torch/nn/functional.py
@@ -1352,7 +1352,7 @@
         out_size = (n,) + input.size()[2:]
         if target.size()[1:] != input.size()[2:]:
             raise ValueError('Expected target size {}, got {}'.format(
-                out_size, input.size()))
+                out_size, target.size()))
         input = input.contiguous().view(n, c, 1, -1)
         target = target.contiguous().view(n, 1, -1)
         if reduce: