class_docstr: Compute attention bias for each head.
class_docstr_tok: ["Compute","attention","bias","for","each","head","."]
code: def __init__(self, config: GraphormerConfig):
      super().__init__()
      self.num_heads = config.num_attention_heads
      self.multi_hop_max_dist = config.multi_hop_max_dist
  
      # We do not change edge feature embedding learning, as edge embeddings are represented as a combination of the original features
      # + shortest path
      self.edge_encoder = nn.Embedding(
          config.num_edges + 1,
          config.num_attention_heads,
          padding_idx=0,
      )
  
      self.edge_type = config.edge_type
      if self.edge_type == "multi_hop":
          self.edge_dis_encoder = nn.Embedding(
              config.num_edge_dis
              * config.num_attention_heads
              * config.num_attention_heads,
              1,
          )
  
      self.spatial_pos_encoder = nn.Embedding(
          config.num_spatial, config.num_attention_heads, padding_idx=0
      )
  
      self.graph_token_virtual_distance = nn.Embedding(
          1, config.num_attention_heads
      )
  
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 GraphormerGraphAttnBias object from inherited base classes: nn with example: obj = GraphormerGraphAttnBias(config)