code: def forward(
      self,
      entity_emb,
      user_emb,
      relation_emb,
      edge_index,
      edge_type,
      inter_matrix,
  ):
      from torch_scatter import scatter_softmax, scatter_mean
  
      n_entities = entity_emb.shape[0]
  
      # KG aggregate
      head, tail = edge_index
      edge_relation_emb = relation_emb[edge_type]
      neigh_relation_emb = (
          entity_emb[tail] * edge_relation_emb
      )  # [-1, embedding_size]
  
      if self.attention:
          # Calculate attention weights
          neigh_relation_emb_weight = self.calculate_sim_hrt(
              entity_emb[head], entity_emb[tail], edge_relation_emb
          )
          # [-1, 1] -> [-1, embedding_size]
          neigh_relation_emb_weight = neigh_relation_emb_weight.expand(
              neigh_relation_emb.shape[0], neigh_relation_emb.shape[1]
          )
          neigh_relation_emb_weight = scatter_softmax(
              neigh_relation_emb_weight, index=head, dim=0
          )  # [-1, embedding_size]
          neigh_relation_emb = torch.mul(
              neigh_relation_emb_weight, neigh_relation_emb
          )
  
      entity_agg = scatter_mean(
          src=neigh_relation_emb, index=head, dim_size=n_entities, dim=0
      )  # [n_entities, embedding_size]
  
      # Only aggregate item embedding
      if self.item_only:
          return entity_agg
  
      user_agg = torch.sparse.mm(
          inter_matrix, entity_emb
      )  # [n_users, embedding_size]
      # The importance of relation to user
      score = torch.mm(
          user_emb, relation_emb.t()
      )  # [n_users, n_relations]
      score = torch.softmax(score, dim=-1)
      user_agg = user_agg + (torch.mm(score, relation_emb)) * user_agg
  
      return entity_agg, user_agg
  
imports: import numpy
  import scipy.sparse
  import torch
  import torch.nn
  import torch.nn.functional
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.layers import SparseDropout
  from recbole.model.loss import BPRLoss, EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 2 for calling the Aggregator obj's underlying member method code with example usage: obj.forward(entity_emb, user_emb, relation_emb, edge_index, edge_type, inter_matrix) and returns: entity_agg,  user_agg, entity_agg