Pyro: Beta distribution sometimes returns -inf, sometimes nan for extreme support values (v0.1.2)

Created on 24 Jan 2018  路  2Comments  路  Source: pyro-ppl/pyro

Example:

In [37]: beta_5_5 = dist.Beta(Variable(Tensor([5])), Variable(Tensor([5])))

In [38]: beta_1_1 = dist.Beta(Variable(Tensor([1])), Variable(Tensor([1])))

In [39]: beta_5_5.log_pdf(Variable(Tensor([0])))
Out[39]:
Variable containing:
-inf
[torch.FloatTensor of size 1]

In [40]: beta_1_1.log_pdf(Variable(Tensor([0])))
Out[40]:
Variable containing:
nan
[torch.FloatTensor of size 1]

I would have expected the same output in both cases.

bug

All 2 comments

Hi Andreas, this should hopefully already be fixed on Pyro dev branch since we've switched to PyTorch distributions and have been very careful to clamp extreme values of Beta and Dirichlet distributions (code). Closing this as "fixed on dev". This should be in Pyro 0.2 release within a month. Feel free to re-open if you experience this on dev branch against PyTorch master.

Just to confirm: The problem goes away with torch master and pyro dev.

Was this page helpful?
0 / 5 - 0 ratings