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()
答案 0 :(得分:2)
使用FloatTensor
与torch==0.4.0
:
import torch
from torch.distributions import Beta
m = Beta(torch.FloatTensor([2]), torch.FloatTensor([2]))
m.sample()