class_docstr: Implementation of graph attention networks (GAT)
  This is an implementation of the paper GRAPH ATTENTION NETWORKS
  (https://arxiv.org/abs/1710.10903).
  Args:
      input_size: The size of the inputs. 
      hidden_size: The hidden size for gat.
      activation: (default None) The activation for the output.
      num_heads: (default 1) The head number in gat.
      feat_drop: (default 0.6) Dropout rate for feature.
      attn_drop: (default 0.6) Dropout rate for attention.
      concat: (default True) Whether to concat output heads or average them.
class_docstr_tok: ["Implementation","of","graph","attention","networks","(","GAT",")","This","is","an","implementation","of","the","paper","GRAPH","ATTENTION","NETWORKS","(","https",":","\/\/arxiv.org\/abs\/1710.10903",")",".","Args",":","input_size",":","The","size","of","the","inputs",".","hidden_size",":","The","hidden","size","for","gat",".","activation",":","(","default","None",")","The","activation","for","the","output",".","num_heads",":","(","default","1",")","The","head","number","in","gat",".","feat_drop",":","(","default","0.6",")","Dropout","rate","for","feature",".","attn_drop",":","(","default","0.6",")","Dropout","rate","for","attention",".","concat",":","(","default","True",")","Whether","to","concat","output","heads","or","average","them","."]
code: def __init__(
      self,
      input_size,
      hidden_size,
      feat_drop=0.6,
      attn_drop=0.6,
      num_heads=1,
      concat=True,
      activation=None,
      use_edge=False,
      dis_type="square",
  ):
      super(GATConv, self).__init__()
      self.hidden_size = hidden_size
      self.num_heads = num_heads
      self.feat_drop = feat_drop
      self.attn_drop = attn_drop
      self.concat = concat
      self.dis_type = dis_type
      if use_edge:
          self.edge_mlp = nn.Sequential(
              nn.Linear(8, 128),
              nn.ReLU(),
              nn.Dropout(p=0.3),
              nn.Linear(128, num_heads),
          )
      self.pos_mlp = nn.Sequential(
          nn.Linear(1, 128),
          nn.ReLU(),
          nn.Dropout(p=0.3),
          nn.Linear(128, num_heads),
      )
      self.linear = linear_init(
          input_size, num_heads * hidden_size, init_type="gcn"
      )
  
      fc_w_attr = paddle.ParamAttr(
          initializer=nn.initializer.XavierNormal()
      )
      self.weight_src = self.create_parameter(
          shape=[1, num_heads, hidden_size], attr=fc_w_attr
      )
  
      fc_w_attr = paddle.ParamAttr(
          initializer=nn.initializer.XavierNormal()
      )
      self.weight_dst = self.create_parameter(
          shape=[1, num_heads, hidden_size], attr=fc_w_attr
      )
  
      self.feat_dropout = nn.Dropout(p=feat_drop)
      self.attn_dropout = nn.Dropout(p=attn_drop)
      self.leaky_relu = nn.LeakyReLU(negative_slope=0.2)
      if isinstance(activation, str):
          activation = getattr(F, activation)
      self.activation = activation
  
file_path: PGL/examples/NeurIPS2022-OGB-Challenge/MAG240M/models/gat_conv_peg.py
imports: import math
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from pgl.utils.logger import log
  import pgl
  from pgl.nn import functional
label_desc: Use image node_id 1 to create a new GATConv object from inherited base classes: nn with example: obj = GATConv(input_size, hidden_size, feat_drop, attn_drop, num_heads, concat, activation, use_edge, dis_type)