class_docstr: 基于图的 parser base class，支持 **贪婪解码** 和 **最大生成树解码**
class_docstr_tok: ["\u57fa\u4e8e\u56fe\u7684","parser","base","class\uff0c\u652f\u6301","*","*","\u8d2a\u5a6a\u89e3\u7801","*","*","\u548c","*","*","\u6700\u5927\u751f\u6210\u6811\u89e3\u7801","*","*"]
code: def __init__(self):
      super(GraphParser, self).__init__()
  
imports: from collections import defaultdict
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ...core.utils import seq_len_to_mask
  from ...embeddings.torch.utils import get_embeddings
  from ...modules.torch.dropout import TimestepDropout
  from ...modules.torch.encoder.transformer import TransformerEncoder
  from ...modules.torch.encoder.variational_rnn import VarLSTM
label_desc: Use image node_id 1 to create a new GraphParser object from inherited base classes: nn with example: obj = GraphParser()