Added tensor size warning to F.mse_loss() (#18349)
authormc-robinson <matthew.robinson@yale.edu>
Mon, 25 Mar 2019 02:17:00 +0000 (19:17 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 25 Mar 2019 02:22:14 +0000 (19:22 -0700)
commit8bc5b867093f1b44f5168f3e41b1bdf0ba3e05a7
treea16ec7e849c73aeb589793b7b481925f9e88bcbf
parentca962f0f95185e76b1f43a4423d28986ee0da191
Added tensor size warning to F.mse_loss() (#18349)

Summary:
To address the issue of broadcasting giving the wrong result in `nn.MSELoss()` as mentioned here https://github.com/pytorch/pytorch/issues/16045 . In particular, the issue often arises when computing the loss between tensors with shapes (n, 1) and (n,)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18349

Differential Revision: D14594176

Pulled By: soumith

fbshipit-source-id: f23ae68a4bf42f3554ad7678a314ba2c7532a6db
test/test_nn.py
torch/nn/functional.py