Skip to content

Commit

Permalink
checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha committed Apr 8, 2020
1 parent 9f4630d commit a792af7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion torch_struct/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def marginals(self):
def count(self):
"Compute the log-partition function."
return self._struct(StdSemiring).sum(
self.log_potentials.ones_like(self.log_potentials), self.lengths
torch.ones_like(self.log_potentials), self.lengths
)

# @constraints.dependent_property
Expand Down
1 change: 1 addition & 0 deletions torch_struct/semirings/semirings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
has_genbmm = False
try:
import genbmm

has_genbmm = True
except ImportError:
pass
Expand Down
3 changes: 3 additions & 0 deletions torch_struct/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def test_simple(data, seed):
marginals = dist.marginals
assert ((samples.mean(0) - marginals).abs() < 0.2).all()

kmax = dist.kmax(5)
count = dist.count


@given(data(), integers(min_value=1, max_value=20))
@settings(max_examples=50, deadline=None)
Expand Down

0 comments on commit a792af7

Please sign in to comment.