class_docstr:     Graph2Tree is a general end-to-end neural encoder-decoder model that maps an input graph
      to a tree structure. The graph2tree model consists the following components: 1) node
      embedding 2) graph embedding 3) tree decoding. 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.
  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 type. Expected in ["gcn", "gat", "graphsage", "ggnn"]
  embedding_style: dict
      The options used in the embedding module.
class_docstr_tok: ["Graph2Tree","is","a","general","end-to-end","neural","encoder-decoder","model","that","maps","an","input","graph","to","a","tree","structure",".","The","graph2tree","model","consists","the","following","components",":","1",")","node","embedding","2",")","graph","embedding","3",")","tree","decoding",".","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",".","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","type",".","Expected","in","[","``","gcn","''",",","``","gat","''",",","``","graphsage","''",",","``","ggnn","''","]","embedding_style",":","dict","The","options","used","in","the","embedding","module","."]
code: def forward(self, batch_graph, tgt_tree_batch, oov_dict=None):
      batch_graph = self.graph_initializer(batch_graph)
      if hasattr(self, "graph_topology") and hasattr(
          self.graph_topology, "dynamic_topology"
      ):
          batch_graph = self.graph_topology.dynamic_topology(
              batch_graph
          )
      batch_graph = self.gnn_encoder(batch_graph)
      batch_graph.node_features["rnn_emb"] = batch_graph.node_features[
          "node_feat"
      ]
  
      loss = self.decoder(
          g=batch_graph,
          tgt_tree_batch=tgt_tree_batch,
          oov_dict=oov_dict,
      )
      return loss
  
imports: import copy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.nn.init
  from graph4nlp.pytorch.models.base import Graph2XBase
  from graph4nlp.pytorch.modules.prediction.generation.decoder_strategy import DecoderStrategy
  from graph4nlp.pytorch.modules.prediction.generation.TreeBasedDecoder import StdTreeDecoder
  from graph4nlp.pytorch.modules.utils.tree_utils import Tree, to_cuda
label_desc: Use image node_id 2 for calling the Graph2Tree obj's underlying member method code with example usage: obj.forward(batch_graph, tgt_tree_batch, oov_dict) and returns: loss