Beta Distribution in PyTorch for a, b>1?

时间:2018-06-04 17:44:07

标签: distribution pytorch

PyTorch supports Beta distributions however, when alpha or beta is greater than 1, it doesn't work:

m = Beta(torch.tensor([2]), torch.tensor([2]))
m.sample()

1 个答案:

答案 0 :(得分:2)

使用FloatTensortorch==0.4.0

按预期方式工作
import torch
from torch.distributions import Beta
m = Beta(torch.FloatTensor([2]), torch.FloatTensor([2]))
m.sample()