You are accidentally broadcasting the output and target tensor inside your training loop and this should also raise a warning in the latest stable PyTorch version.
Add y = y.view(-1, 1) to your training and validation loop and try to run the code again.
PS: If you are using an older PyTorch version, I would recommend to update to the latest release. 
Also, call the model directly as model(data) instead of model.forward(data), as this will make sure to register hooks etc.