code: def __init__(
      self,
      in_dim,
      out_dim,
      node_dict,
      edge_dict,
      n_heads,
      dropout=0.2,
      use_norm=False,
  ):
      super(HGTLayer, self).__init__()
  
      self.in_dim = in_dim
      self.out_dim = out_dim
      self.node_dict = node_dict
      self.edge_dict = edge_dict
      self.num_types = len(node_dict)
      self.num_relations = len(edge_dict)
      self.total_rel = (
          self.num_types * self.num_relations * self.num_types
      )
      self.n_heads = n_heads
      self.d_k = out_dim // n_heads
      self.sqrt_dk = math.sqrt(self.d_k)
      self.att = None
  
      self.k_linears = nn.ModuleList()
      self.q_linears = nn.ModuleList()
      self.v_linears = nn.ModuleList()
      self.a_linears = nn.ModuleList()
      self.norms = nn.ModuleList()
      self.use_norm = use_norm
  
      for t in range(self.num_types):
          self.k_linears.append(nn.Linear(in_dim, out_dim))
          self.q_linears.append(nn.Linear(in_dim, out_dim))
          self.v_linears.append(nn.Linear(in_dim, out_dim))
          self.a_linears.append(nn.Linear(out_dim, out_dim))
          if use_norm:
              self.norms.append(nn.LayerNorm(out_dim))
  
      self.relation_pri = nn.Parameter(
          torch.ones(self.num_relations, self.n_heads)
      )
      self.relation_att = nn.Parameter(
          torch.Tensor(self.num_relations, n_heads, self.d_k, self.d_k)
      )
      self.relation_msg = nn.Parameter(
          torch.Tensor(self.num_relations, n_heads, self.d_k, self.d_k)
      )
      self.skip = nn.Parameter(torch.ones(self.num_types))
      self.drop = nn.Dropout(dropout)
  
      nn.init.xavier_uniform_(self.relation_att)
      nn.init.xavier_uniform_(self.relation_msg)
  
imports: import dgl
  import math
  import torch
  import torch.nn
  import torch.nn.functional
  import dgl.function
  from dgl.nn.functional import edge_softmax
label_desc: Use image node_id 1 to create a new HGTLayer object from inherited base classes: nn with example: obj = HGTLayer(in_dim, out_dim, node_dict, edge_dict, n_heads, dropout, use_norm)