code: def apply_attention(self, edge_index, num_nodes, x_i, x_j):
      if self.att_type == "gat":
          alpha = (torch.cat([x_i, x_j], dim=-1) * self.att).sum(dim=-1)
          alpha = F.leaky_relu(alpha, self.negative_slope)
  
      elif self.att_type == "gat_sym":
          wl = self.att[:, :, : self.out_channels]  # weight left
          wr = self.att[:, :, self.out_channels :]  # weight right
          alpha = (x_i * wl).sum(dim=-1) + (x_j * wr).sum(dim=-1)
          alpha_2 = (x_j * wl).sum(dim=-1) + (x_i * wr).sum(dim=-1)
          alpha = F.leaky_relu(
              alpha, self.negative_slope
          ) + F.leaky_relu(alpha_2, self.negative_slope)
  
      elif self.att_type == "linear":
          wl = self.att[:, :, : self.out_channels]  # weight left
          wr = self.att[:, :, self.out_channels :]  # weight right
          al = x_j * wl
          ar = x_j * wr
          alpha = al.sum(dim=-1) + ar.sum(dim=-1)
          alpha = torch.tanh(alpha)
      elif self.att_type == "cos":
          wl = self.att[:, :, : self.out_channels]  # weight left
          wr = self.att[:, :, self.out_channels :]  # weight right
          alpha = x_i * wl * x_j * wr
          alpha = alpha.sum(dim=-1)
  
      elif self.att_type == "generalized_linear":
          wl = self.att[:, :, : self.out_channels]  # weight left
          wr = self.att[:, :, self.out_channels :]  # weight right
          al = x_i * wl
          ar = x_j * wr
          alpha = al + ar
          alpha = torch.tanh(alpha)
          alpha = self.general_att_layer(alpha)
      else:
          raise Exception("Wrong attention type:", self.att_type)
      return alpha
  
imports: import torch
  from torch import nn
  import torch.nn.functional
  import dgl
  from dgl.nn.pytorch.conv import *
  import dgl.function
  import math
  from dgl.utils import expand_as_pair
  from dgl.nn.functional import edge_softmax
  from torch.nn import Parameter
  import torch
  from torch import Tensor
  from ..scatter_utils import *
  from typing import Optional, Tuple, Union
label_desc: Use image node_id 6 for calling the GeoLayer obj's underlying member method code with example usage: obj.apply_attention(edge_index, num_nodes, x_i, x_j) and returns: alpha