class_docstr: 评估parser的性能
class_docstr_tok: ["\u8bc4\u4f30parser\u7684\u6027\u80fd"]
docstr: :param pred1: 边预测logits
  :param pred2: label预测logits
  :param target1: 真实边的标注
  :param target2: 真实类别的标注
  :param seq_len: 序列长度
  :return dict: 评估结果::
  
      UAS: 不带label时, 边预测的准确率
      LAS: 同时预测边和label的准确率
docstr_tok: [":","param","pred1",":","\u8fb9\u9884\u6d4blogits",":","param","pred2",":","label\u9884\u6d4blogits",":","param","target1",":","\u771f\u5b9e\u8fb9\u7684\u6807\u6ce8",":","param","target2",":","\u771f\u5b9e\u7c7b\u522b\u7684\u6807\u6ce8",":","param","seq_len",":","\u5e8f\u5217\u957f\u5ea6",":","return","dict",":","\u8bc4\u4f30\u7ed3\u679c",":",":","UAS",":","\u4e0d\u5e26label\u65f6",",","\u8fb9\u9884\u6d4b\u7684\u51c6\u786e\u7387","LAS",":","\u540c\u65f6\u9884\u6d4b\u8fb9\u548clabel\u7684\u51c6\u786e\u7387"]
code: def update(self, pred1, pred2, target1, target2, seq_len=None):
      r"""
  
      :param pred1: 边预测logits
      :param pred2: label预测logits
      :param target1: 真实边的标注
      :param target2: 真实类别的标注
      :param seq_len: 序列长度
      :return dict: 评估结果::
  
          UAS: 不带label时, 边预测的准确率
          LAS: 同时预测边和label的准确率
      """
      if seq_len is None:
          seq_mask = pred1.new_ones(pred1.size(), dtype=torch.long)
      else:
          seq_mask = seq_len_to_mask(seq_len.long()).long()
      # mask out <root> tag
      seq_mask[:, 0] = 0
      head_pred_correct = (pred1 == target1).long() * seq_mask
      label_pred_correct = (pred2 == target2).long() * head_pred_correct
      self.num_arc += head_pred_correct.sum().item()
      self.num_label += label_pred_correct.sum().item()
      self.num_sample += seq_mask.sum().item()
  
file_path: fastNLP/tests/models/torch/test_biaffine_parser.py
imports: import pytest
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP import Metric, seq_len_to_mask
  from .model_runner import *
label_desc: Use image node_id 3 for calling the ParserMetric obj's underlying member method code with example usage: obj.update(pred1, pred2, target1, target2, seq_len) without return types