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","."]
docstr:     Decoding with the support of beam_search.
      Specifically, when ``beam_size`` is 1, it is equal to greedy search.
  Parameters
  ----------
  batch_graph: GraphData
      The graph input
  beam_size: int
      The beam width. When it is 1, the output is equal to greedy search's output.
  topk: int, default=1
      The number of decoded output to be reserved.
      Usually, ``topk`` should be smaller or equal to ``beam_size``
  oov_dict: VocabModel, default=None
      The vocabulary for copy.
  
  Returns
  -------
  results: torch.Tensor
      The results with the shape of ``[batch_size, topk, max_decoder_step]`` containing the word indexes. # noqa
docstr_tok: ["Decoding","with","the","support","of","beam_search",".","Specifically",",","when","``","beam_size","``","is","1",",","it","is","equal","to","greedy","search",".","Parameters","--","--","--","--","--","batch_graph",":","GraphData","The","graph","input","beam_size",":","int","The","beam","width",".","When","it","is","1",",","the","output","is","equal","to","greedy","search","'s","output",".","topk",":","int",",","default=1","The","number","of","decoded","output","to","be","reserved",".","Usually",",","``","topk","``","should","be","smaller","or","equal","to","``","beam_size","``","oov_dict",":","VocabModel",",","default=None","The","vocabulary","for","copy",".","Returns","--","--","--","-","results",":","torch.Tensor","The","results","with","the","shape","of","``","[","batch_size",",","topk",",","max_decoder_step","]","``","containing","the","word","indexes",".","#","noqa"]
code: def inference_forward(
      self, batch_graph, beam_size, topk=1, oov_dict=None
  ):
      """
          Decoding with the support of beam_search.
          Specifically, when ``beam_size`` is 1, it is equal to greedy search.
      Parameters
      ----------
      batch_graph: GraphData
          The graph input
      beam_size: int
          The beam width. When it is 1, the output is equal to greedy search's output.
      topk: int, default=1
          The number of decoded output to be reserved.
          Usually, ``topk`` should be smaller or equal to ``beam_size``
      oov_dict: VocabModel, default=None
          The vocabulary for copy.
  
      Returns
      -------
      results: torch.Tensor
          The results with the shape of ``[batch_size, topk, max_decoder_step]`` containing the word indexes. # noqa
      """
      return self.translate(
          input_graph=batch_graph["graph_data"],
          use_beam_search=(beam_size > 1),
          beam_size=beam_size,
          oov_dict=oov_dict,
      )
  
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 6 for calling the Graph2Tree obj's underlying member method code with example usage: obj.inference_forward(batch_graph, beam_size, topk, oov_dict) and returns: self