Which PyTorch version are you using?
This method with these arguments is available in the latest stable release (0.4.0).
I accidentally copied a link to the master doc. Here is the right one pointing to the latest release: link 11.
If your PyTorch version is < 0.4.0, I would suggest to update it.
You can find the install instructions on the website 1.