Complete distributions package

How can I install distributions package for pytorch?

import torch.distributions
import torch.distributions.uniform
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘torch.distributions.uniform’; ‘torch.distributions’ is not a package


Which PyTorch version are you using (print(torch.__version__))?
If you are using an older one, you could update it using the instructions on the website.

I need to use version 0.3.1

A lot was added into PyTorch since 0.3.1.
Why do you have to use this old version?
If you need help porting your code, feel free to post it here or create a new topic.

Thanks @ptrblck

By updating torch version to 0.4, I would face some errors in some parts of the code. Such:

return x.cuda(self.primary_gpu, async=True)
SyntaxError: invalid syntax

I could recommend to update to 1.1.0 and use the .to(device, non_blocking=True) method.
Have a look at the release notes for 0.4 to see some necessary changes. Also the most recent release notes will be useful.

1 Like

Thanks, anyway there is no way to use “distributions package” in pytorch 0.3?

There are some distributions in 0.3.1 as seen here. However a lot of distributions were added after the 0.3.1 release.

1 Like