Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
srush committed Nov 26, 2019
1 parent e92deaa commit 9e9a863
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch_struct/linearchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _dp_scan(self, log_potentials, lengths=None, force_grad=False):
mask = torch.arange(bin_N).view(1, bin_N).expand(batch, bin_N)
mask = mask >= (lengths - 1).view(batch, 1)
lp.data[:, mask.view(-1)] = semiring.zero
c.data[:, (1- mask).view(-1)] = semiring.zero
c.data[:, (~mask).view(-1)] = semiring.zero
c[:] = semiring.sum(torch.stack([c, lp], dim=-1))


Expand Down

0 comments on commit 9e9a863

Please sign in to comment.