class_docstr:     The graph2seq model consists the following components: 1) node embedding 2) graph embedding 3) decoding. # noqa
      Since the full pipeline will consist all parameters, so we will add prefix to the original parameters
       in each component as follows (except the listed four parameters):
          1) emb_ + parameter_name (eg: ``emb_input_size``)
          2) gnn_ + parameter_name (eg: ``gnn_direction_option``)
          3) dec_ + parameter_name (eg: ``dec_max_decoder_step``)
      Considering neatness, we will only present the four hyper-parameters which don't meet regulations.
      Examples
      -------
      # Build a vocab model from scratch
      >>> "It is just a how-to-use example."
      >>> from graph4nlp.pytorch.modules.config import get_basic_args
      >>> opt = get_basic_args(graph_construction_name="node_emb", graph_embedding_name="gat", decoder_name="stdrnn")
      >>> graph2seq = Graph2Seq.from_args(opt=opt, vocab_model=vocab_model, device=torch.device("cuda:0"))
      >>> batch_graph = [GraphData() for _ in range(2)]
      >>> tgt_seq = torch.Tensor([[1, 2, 3], [4, 5, 6]])
      >>> seq_out, _, _ = graph2seq(batch_graph=batch_graph, tgt_seq=tgt_seq)
      >>> print(seq_out.shape) # [2, 6, 5] (assume the vocabulary size is 5 and max_decoder_step is 6)
  Parameters
  ----------
  vocab_model: VocabModel
      The vocabulary.
  graph_name: str
      The graph type. Excepted in ["dependency", "constituency", "node_emb", "node_emb_refined"].
  gnn: str
      The graph neural network's name. Expected in ["gcn", "gat", "graphsage", "ggnn"]
class_docstr_tok: ["The","graph2seq","model","consists","the","following","components",":","1",")","node","embedding","2",")","graph","embedding","3",")","decoding",".","#","noqa","Since","the","full","pipeline","will","consist","all","parameters",",","so","we","will","add","prefix","to","the","original","parameters","in","each","component","as","follows","(","except","the","listed","four","parameters",")",":","1",")","emb_","+","parameter_name","(","eg",":","``","emb_input_size","``",")","2",")","gnn_","+","parameter_name","(","eg",":","``","gnn_direction_option","``",")","3",")","dec_","+","parameter_name","(","eg",":","``","dec_max_decoder_step","``",")","Considering","neatness",",","we","will","only","present","the","four","hyper-parameters","which","do","n't","meet","regulations",".","Examples","--","--","--","-","#","Build","a","vocab","model","from","scratch",">",">",">","``","It","is","just","a","how-to-use","example",".","''",">",">",">","from","graph4nlp.pytorch.modules.config","import","get_basic_args",">",">",">","opt","=","get_basic_args","(","graph_construction_name=","''","node_emb","''",",","graph_embedding_name=","''","gat","''",",","decoder_name=","''","stdrnn","''",")",">",">",">","graph2seq","=","Graph2Seq.from_args","(","opt=opt",",","vocab_model=vocab_model",",","device=torch.device","(","``","cuda:0","''",")",")",">",">",">","batch_graph","=","[","GraphData","(",")","for","_","in","range","(","2",")","]",">",">",">","tgt_seq","=","torch.Tensor","(","[","[","1",",","2",",","3","]",",","[","4",",","5",",","6","]","]",")",">",">",">","seq_out",",","_",",","_","=","graph2seq","(","batch_graph=batch_graph",",","tgt_seq=tgt_seq",")",">",">",">","print","(","seq_out.shape",")","#","[","2",",","6",",","5","]","(","assume","the","vocabulary","size","is","5","and","max_decoder_step","is","6",")","Parameters","--","--","--","--","--","vocab_model",":","VocabModel","The","vocabulary",".","graph_name",":","str","The","graph","type",".","Excepted","in","[","``","dependency","''",",","``","constituency","''",",","``","node_emb","''",",","``","node_emb_refined","''","]",".","gnn",":","str","The","graph","neural","network","'s","name",".","Expected","in","[","``","gcn","''",",","``","gat","''",",","``","graphsage","''",",","``","ggnn","''","]"]
docstr:     The function for building ``Graph2Seq`` model.
  Parameters
  ----------
  opt: dict
      The configuration dict. It should has the same hierarchy and keys as the template.
  vocab_model: VocabModel
      The vocabulary.
  
  Returns
  -------
  model: Graph2Seq
docstr_tok: ["The","function","for","building","``","Graph2Seq","``","model",".","Parameters","--","--","--","--","--","opt",":","dict","The","configuration","dict",".","It","should","has","the","same","hierarchy","and","keys","as","the","template",".","vocab_model",":","VocabModel","The","vocabulary",".","Returns","--","--","--","-","model",":","Graph2Seq"]
code: def from_args(cls, opt, vocab_model):
      """
          The function for building ``Graph2Seq`` model.
      Parameters
      ----------
      opt: dict
          The configuration dict. It should has the same hierarchy and keys as the template.
      vocab_model: VocabModel
          The vocabulary.
  
      Returns
      -------
      model: Graph2Seq
      """
      initializer_args = cls._get_node_initializer_params(opt)
      gnn_args = cls._get_gnn_params(opt)
      dec_args = cls._get_decoder_params(opt)
  
      args = copy.deepcopy(initializer_args)
      args.update(gnn_args)
      args.update(dec_args)
      args["share_vocab"] = opt["graph_construction_args"][
          "graph_construction_share"
      ]["share_vocab"]
      return cls(vocab_model=vocab_model, **args)
  
imports: import copy
  import torch.nn.functional
  from graph4nlp.pytorch.modules.graph_embedding_initialization.embedding_construction import WordEmbedding
  from graph4nlp.pytorch.modules.prediction.generation.decoder_strategy import DecoderStrategy
  from graph4nlp.pytorch.modules.prediction.generation.StdRNNDecoder import StdRNNDecoder
  from graph4nlp.pytorch.modules.utils.generic_utils import wordid2str
  from .base import Graph2XBase
label_desc: Use image node_id 9 for calling the Graph2Seq obj's underlying member method code with example usage: obj.from_args(cls, opt, vocab_model) and returns: cls