class_docstr: Initial graph embedding construction class.
  
  Parameters
  ----------
  word_vocab : Vocab
      The word vocabulary.
  single_token_item : bool
      Specify whether the item (i.e., node or edge) contains single token or multiple tokens.
  emb_strategy : str
      Specify the embedding construction strategy including the following options:
          - 'w2v_bilstm': use word2vec embeddings, and apply BiLSTM encoders.
          - 'w2v_bigru': use word2vec embeddings, and apply BiGRU encoders.
          - 'w2v_bert_bilstm': use word2vec and BERT embeddings, and apply BiLSTM encoders.
          - 'w2v_bert_bigru': use word2vec and BERT embeddings, and apply BiGRU encoders.
  hidden_size : int, optional
      The hidden size of RNN layer, default: ``None``.
  num_rnn_layers : int, optional
      The number of RNN layers, default: ``1``.
  fix_word_emb : boolean, optional
      Specify whether to fix pretrained word embeddings, default: ``True``.
  fix_bert_emb : boolean, optional
      Specify whether to fix pretrained BERT embeddings, default: ``True``.
  bert_model_name : str, optional
      Specify the BERT model name, default: ``'bert-base-uncased'``.
  bert_lower_case : bool, optional
      Specify whether to lower case the input text for BERT embeddings, default: ``True``.
  word_dropout : float, optional
      Dropout ratio for word embedding, default: ``None``.
  bert_dropout : float, optional
      Dropout ratio for BERT embedding, default: ``None``.
  rnn_dropout : float, optional
      Dropout ratio for RNN embedding, default: ``None``.
code: def __init__(
      self,
      word_vocab,
      single_token_item,
      emb_strategy="w2v_bilstm",
      hidden_size=None,
      num_rnn_layers=1,
      fix_word_emb=True,
      fix_bert_emb=True,
      bert_model_name="bert-base-uncased",
      bert_lower_case=True,
      word_dropout=None,
      bert_dropout=None,
      rnn_dropout=None,
  ):
      super(FusedEmbeddingConstruction, self).__init__()
      self.word_dropout = word_dropout
      self.bert_dropout = bert_dropout
      self.rnn_dropout = rnn_dropout
  
      assert emb_strategy in (
          "w2v",
          "w2v_bilstm",
          "w2v_bigru",
          "w2v_bert_bilstm",
          "w2v_bert_bigru",
      ), (
          "emb_strategy must be one of "
          "('w2v', 'w2v_bilstm', 'w2v_bigru', 'w2v_bert_bilstm', 'w2v_bert_bigru')"
      )
  
      word_emb_type = set()
      word_emb_type.add("w2v")
  
      if "bert" in emb_strategy:
          word_emb_type.add("seq_bert")
  
      if "bilstm" in emb_strategy:
          seq_info_encode_strategy = "bilstm"
      elif "bigru" in emb_strategy:
          seq_info_encode_strategy = "bigru"
      else:
          seq_info_encode_strategy = "none"
  
      word_emb_size = word_vocab.embeddings.shape[1]
      answer_feat_size = word_emb_size
  
      self.word_emb_layers = nn.ModuleDict()
      self.word_emb_layers["w2v"] = WordEmbedding(
          word_vocab.embeddings.shape[0],
          word_vocab.embeddings.shape[1],
          pretrained_word_emb=word_vocab.embeddings,
          fix_emb=fix_word_emb,
      )
  
      enc_input_dim = word_emb_size * 2
      bert_dim = 0
      if "seq_bert" in word_emb_type:
          self.word_emb_layers["seq_bert"] = BertEmbedding(
              name=bert_model_name,
              fix_emb=fix_bert_emb,
              lower_case=bert_lower_case,
          )
          bert_dim = self.word_emb_layers[
              "seq_bert"
          ].bert_model.config.hidden_size
          answer_feat_size += bert_dim
          enc_input_dim += bert_dim
  
      self.ans_rnn_encoder = RNNEmbedding(
          answer_feat_size,
          hidden_size=hidden_size,
          bidirectional=True,
          num_layers=1,
          rnn_type="lstm"
          if seq_info_encode_strategy == "bilstm"
          else "gru",
          dropout=rnn_dropout,
      )
  
      self.ctx_rnn_encoder = RNNEmbedding(
          enc_input_dim,
          hidden_size=hidden_size,
          bidirectional=True,
          num_layers=1,
          rnn_type="lstm"
          if seq_info_encode_strategy == "bilstm"
          else "gru",
          dropout=rnn_dropout,
      )
  
      self.ctx_rnn_encoder_l2 = RNNEmbedding(
          2 * hidden_size,
          hidden_size=hidden_size,
          bidirectional=True,
          num_layers=1,
          rnn_type="lstm"
          if seq_info_encode_strategy == "bilstm"
          else "gru",
          dropout=rnn_dropout,
      )
  
      self.ctx2ans_attn_l1 = Context2AnswerAttention(
          word_emb_size, hidden_size
      )
      self.ctx2ans_attn_l2 = Context2AnswerAttention(
          word_emb_size + hidden_size + bert_dim, hidden_size
      )
  
file_path: graph4nlp/examples/pytorch/question_generation/fused_embedding_construction.py
imports: import torch
  import torch.nn
  from graph4nlp.pytorch.data.data import from_batch
  from graph4nlp.pytorch.modules.graph_embedding_initialization.embedding_construction import BertEmbedding, EmbeddingConstructionBase, RNNEmbedding, WordEmbedding
  from graph4nlp.pytorch.modules.utils import constants
  from graph4nlp.pytorch.modules.utils.generic_utils import dropout_fn
label_desc: Use image node_id 1 to create a new FusedEmbeddingConstruction object from inherited base classes: EmbeddingConstructionBase with example: obj = FusedEmbeddingConstruction(word_vocab, single_token_item, emb_strategy, hidden_size, num_rnn_layers, fix_word_emb, fix_bert_emb, bert_model_name, bert_lower_case, word_dropout, bert_dropout, rnn_dropout)