Module 'torch.nn.init' has no attribute 'zeros_'

I’m using Pytorch 0.4.0, torchvision 0.2.1, Python 3.6.4, cuda9.2
When running into nn.init.zeros_(self.rnn.bias)
I got this error:
AttributeError: module 'torch.nn.init' has no attribute 'zeros_'
Why is this happend?
Thank you!

This method was apparently introduced after the 0.4 release. You could call self.rnn.bias.zeros_() in this older release, but I would recommend to update to the latest stable release (1.3.1), since a lot of bugs were fixed and also a lot of improvements as well as features were added.

Thank you for your reply! Of course I’d like to use the latest version. And I tried the latest version. I got different result from 0.4.1, and the result is much worse. And I don’t know where goes wrong. So I have to use the older version.

So Pytorch 0.4.0 is not 0.4 release?

Yes, 0.4.0 is the 0.4 release I’ve mentioned and the function is not available in this old release.
Is my workaround working for you?
Once this works, we should figure out, why the results are worse in the latest release, so please feel free to create a new topic with the issue here.

I tried not using nn.init.zeros_(self.rnn.bias). And I get another error. Pytorch 0.4.0 seems do not have num_batches_tracked . So I gave up on Pytorch 0.4.0.