Пример #1
0
 def decode_output(self,
                   output: Union[torch.Tensor, Dict[str, torch.Tensor], Iterable[torch.Tensor], Any],
                   mask: torch.BoolTensor,
                   batch: Dict[str, Any],
                   decoder, **kwargs) -> Union[Dict[str, Any], Any]:
     (arc_scores, rel_scores), mask = output
     return BiaffineDependencyParser.decode(self, arc_scores, rel_scores, mask, batch)
Пример #2
0
 def decode_output(self, outputs, mask, batch):
     arc_scores, rel_scores = outputs['class_probabilities']['deps']['s_arc'], \
                              outputs['class_probabilities']['deps']['s_rel']
     arc_preds, rel_preds = BiaffineDependencyParser.decode(
         self, arc_scores, rel_scores, mask, batch)
     outputs['arc_preds'], outputs['rel_preds'] = arc_preds, rel_preds
     return outputs