Closed
Description
Getting the following in-place operation error when using the DependencyCRF:
B,N = 3,50
phi = torch.randn(B,N,N)
DependencyCRF(phi).partition
/usr/local/lib/python3.7/dist-packages/torch_struct/deptree.py in _check_potentials(self, arc_scores, lengths)
121 arc_scores = semiring.convert(arc_scores)
122 for b in range(batch):
--> 123 semiring.zero_(arc_scores[:, b, lengths[b] + 1 :, :])
124 semiring.zero_(arc_scores[:, b, :, lengths[b] + 1 :])
125
/usr/local/lib/python3.7/dist-packages/torch_struct/semirings/semirings.py in zero_(xs)
124 @staticmethod
125 def zero_(xs):
--> 126 return xs.fill_(-1e5)
127
128 @staticmethod
RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.
Metadata
Metadata
Assignees
Labels
No labels