Which PyTorch version are you using?
As you are using Variables it seems your version might be < 0.4.0.
If so, could you first update to the latest stable release, if that’s possible?
You can find the install instructions on the website 11.