code: def __init__(self, config: GraphormerConfig):
      super().__init__()
  
      self.dropout_module = torch.nn.Dropout(
          p=config.dropout, inplace=False
      )
      self.layerdrop = config.layerdrop
      self.embedding_dim = config.embedding_dim
      self.apply_graphormer_init = config.apply_graphormer_init
      self.traceable = config.traceable
  
      self.graph_node_feature = GraphormerGraphNodeFeature(config)
      self.graph_attn_bias = GraphormerGraphAttnBias(config)
  
      self.embed_scale = config.embed_scale
  
      if config.q_noise > 0:
          self.quant_noise = quant_noise(
              nn.Linear(
                  self.embedding_dim, self.embedding_dim, bias=False
              ),
              config.q_noise,
              config.qn_block_size,
          )
      else:
          self.quant_noise = None
  
      if config.encoder_normalize_before:
          self.emb_layer_norm = nn.LayerNorm(self.embedding_dim)
      else:
          self.emb_layer_norm = None
  
      if config.pre_layernorm:
          self.final_layer_norm = nn.LayerNorm(self.embedding_dim)
  
      if self.layerdrop > 0.0:
          self.layers = LayerDropModuleList(p=self.layerdrop)
      else:
          self.layers = nn.ModuleList([])
      self.layers.extend(
          [
              GraphormerGraphEncoderLayer(config)
              for _ in range(config.num_hidden_layers)
          ]
      )
  
      # Apply initialization of model params after building the model
      if config.freeze_embeddings:
          raise NotImplementedError(
              "Freezing embeddings is not implemented yet."
          )
  
      for layer in range(config.num_trans_layers_to_freeze):
          m = self.layers[layer]
          if m is not None:
              for p in m.parameters():
                  p.requires_grad = False
  
imports: import math
  from typing import Iterable, Iterator, List, Optional, Tuple, Union
  import torch
  import torch.nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithNoAttention, SequenceClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import logging
  from .configuration_graphormer import GraphormerConfig
label_desc: Use image node_id 1 to create a new GraphormerGraphEncoder object from inherited base classes: nn with example: obj = GraphormerGraphEncoder(config)