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 _reduce_attention(self, msg):
      alpha = msg.reduce_softmax(msg["alpha"])
      alpha = paddle.reshape(alpha, [-1, self.num_heads, 1])
      if self.attn_drop > 1e-15:
          alpha = self.attn_dropout(alpha)
  
      feature = msg["h"]
      feature = paddle.reshape(
          feature, [-1, self.num_heads, self.hidden_size]
      )
      feature = feature * alpha
      if self.concat:
          feature = paddle.reshape(
              feature, [-1, self.num_heads * self.hidden_size]
          )
      else:
          feature = paddle.mean(feature, axis=1)
  
      feature = msg.reduce(feature, pool_type="sum")
      return feature
  
imports: import math
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import pgl
  from pgl.nn import functional
label_desc: Use image node_id 3 for calling the GATConv obj's underlying member method code with example usage: obj._reduce_attention(msg) and returns: feature