Skip to content

Commit ccfbc56

Browse files
committed
Apparently this one detach().cpu() call speeds up the program by 5%
1 parent fbf3239 commit ccfbc56

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

stanza/models/constituency/lstm_model.py

+1
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ def predict(self, states, is_legal=True):
986986
"""
987987
predictions = self.forward(states)
988988
pred_max = torch.argmax(predictions, axis=1)
989+
pred_max = pred_max.detach().cpu()
989990

990991
pred_trans = [self.transitions[pred_max[idx]] for idx in range(len(states))]
991992
if is_legal:

0 commit comments

Comments
 (0)