-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Description
Issue description
reduction parameter to torch.nn.functional.mse_loss is not affecting the output.
Code example
import torch
x = torch.ones(40, 100, requires_grad=True)
y = torch.zeros(40, 100, requires_grad=True)
torch.nn.functional.mse_loss(x, y)
tensor(4000., grad_fn=<SumBackward0>)
torch.nn.functional.mse_loss(x, y, reduce=True)
/usr/local/lib/python3.7/site-packages/torch/nn/functional.py:52: UserWarning: size_average and reduce args will be deprecated, please use reduction='elementwise_mean' instead.
warnings.warn(warning.format(ret))
tensor(4000., grad_fn=<SumBackward0>)
>>> torch.nn.functional.mse_loss(x, y, reduction="elementwise_mean")
tensor(4000., grad_fn=<SumBackward0>)
The issue is in the line https://github.com/pytorch/pytorch/blob/master/torch/nn/functional.py#L1748. Now the `reduction1 values are ints (coming from https://github.com/pytorch/pytorch/blob/master/torch/nn/functional.py#L25) and not strings.
System Info
- PyTorch or Caffe2: PyTorch
- How you installed PyTorch (conda, pip, source): Conda and pip
- OS: Mac and Linux
- PyTorch version: 0.4.1
- Python version: 3.7 and 3.6.5
- CUDA/cuDNN version: NA
- GPU models and configuration: NA
- GCC version (if compiling from source): NA
- CMake version: NA
- Versions of any other relevant libraries: NA
Metadata
Metadata
Assignees
Labels
No labels