Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
srush committed Sep 8, 2019
1 parent b8fc17f commit 05fa029
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torch_struct/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def marginals(self, edge, lengths=None, _autograd=True):
marginals: b x (N-1) x C x C table
"""
v, edge, alpha = self._dp(edge, lengths=lengths, force_grad=True)
v, edges, alpha = self._dp(edge, lengths=lengths, force_grad=True)
if (
_autograd
or self.semiring is not LogSemiring
or not hasattr(self, "_dp_backward")
):
marg = torch.autograd.grad(
v.sum(dim=0),
edge,
edges,
create_graph=True,
only_inputs=True,
allow_unused=False,
Expand Down

0 comments on commit 05fa029

Please sign in to comment.