code: def _build_gnn_encoder(
      self,
      gnn,
      num_layers,
      input_size,
      hidden_size,
      output_size,
      direction_option,
      feats_dropout,
      gnn_heads=None,
      gnn_residual=True,
      gnn_attn_dropout=0.0,
      gnn_activation=F.relu,  # gat
      gnn_bias=True,
      gnn_allow_zero_in_degree=True,
      gnn_norm="both",
      gnn_weight=True,
      gnn_use_edge_weight=False,
      gnn_gcn_norm="both",  # gcn
      gnn_n_etypes=1,  # ggnn
      gnn_aggregator_type="lstm",  # graphsage
      **kwargs,
  ):
      if gnn == "gat":
          self.gnn_encoder = GAT(
              num_layers,
              input_size,
              hidden_size,
              output_size,
              gnn_heads,
              direction_option=direction_option,
              feat_drop=feats_dropout,
              attn_drop=gnn_attn_dropout,
              activation=gnn_activation,
              residual=gnn_residual,
              allow_zero_in_degree=gnn_allow_zero_in_degree,
          )
      elif gnn == "ggnn":
          self.gnn_encoder = GGNN(
              num_layers,
              input_size,
              hidden_size,
              output_size,
              direction_option=direction_option,
              use_edge_weight=gnn_use_edge_weight,
              feat_drop=feats_dropout,
              n_etypes=gnn_n_etypes,
          )
      elif gnn == "graphsage":
          self.gnn_encoder = GraphSAGE(
              num_layers,
              input_size,
              hidden_size,
              output_size,
              aggregator_type=gnn_aggregator_type,
              direction_option=direction_option,
              feat_drop=feats_dropout,
              activation=gnn_activation,
              bias=gnn_bias,
              use_edge_weight=gnn_use_edge_weight,
          )
      elif gnn == "gcn":
          self.gnn_encoder = GCN(
              num_layers,
              input_size,
              hidden_size,
              output_size,
              direction_option=direction_option,
              weight=gnn_weight,
              gcn_norm=gnn_gcn_norm,
              allow_zero_in_degree=gnn_allow_zero_in_degree,
              activation=gnn_activation,
              use_edge_weight=gnn_use_edge_weight,
          )
      else:
          raise NotImplementedError()
  
imports: import abc
  import os
  import torch
  import torch.nn
  import torch.nn.functional
  from graph4nlp.pytorch.modules.graph_construction.node_embedding_based_graph_construction import NodeEmbeddingBasedGraphConstruction
  from graph4nlp.pytorch.modules.graph_construction.node_embedding_based_refined_graph_construction import NodeEmbeddingBasedRefinedGraphConstruction
  from graph4nlp.pytorch.modules.graph_embedding_initialization.graph_embedding_initialization import GraphEmbeddingInitialization
  from graph4nlp.pytorch.modules.graph_embedding_learning.gat import GAT
  from graph4nlp.pytorch.modules.graph_embedding_learning.gcn import GCN
  from graph4nlp.pytorch.modules.graph_embedding_learning.ggnn import GGNN
  from graph4nlp.pytorch.modules.graph_embedding_learning.graphsage import GraphSAGE
label_desc: Use image node_id 3 for calling the Graph2XBase obj's underlying member method code with example usage: obj._build_gnn_encoder(gnn, num_layers, input_size, hidden_size, output_size, direction_option, feats_dropout, gnn_heads, gnn_residual, gnn_attn_dropout, gnn_activation, gnn_bias, gnn_allow_zero_in_degree, gnn_norm, gnn_weight, gnn_use_edge_weight, gnn_gcn_norm, gnn_n_etypes, gnn_aggregator_type) without return types