The code looks generally alright besides some minor issues:


Variables are deprecated since PyTorch 0.4.0, so you can just use tensors directly in newer versions
Although this shouldn’t be an issue in your code, you shouldn’t use the .data attribute, as this might create silent errors in training code

That being said, the learning rate seems to be a bit high.
Have you tried to use other non-linear activations, e.g. relu?
I would recommend to scale down your model (and data) a bit and make it work with a simplified version.
Once your model trains successfully, you could try to scale it up again.