class_docstr: KGIN is a knowledge-aware recommendation model. It combines knowledge graph and the user-item interaction
  graph to a new graph called collaborative knowledge graph (CKG). This model explores intents behind a user-item
  interaction by using auxiliary item knowledge.
class_docstr_tok: ["KGIN","is","a","knowledge-aware","recommendation","model",".","It","combines","knowledge","graph","and","the","user-item","interaction","graph","to","a","new","graph","called","collaborative","knowledge","graph","(","CKG",")",".","This","model","explores","intents","behind","a","user-item","interaction","by","using","auxiliary","item","knowledge","."]
code: def get_norm_inter_matrix(self, mode="bi"):
      # Get the normalized interaction matrix of users and items.
  
      def _bi_norm_lap(A):
          # D^{-1/2}AD^{-1/2}
          rowsum = np.array(A.sum(1))
  
          d_inv_sqrt = np.power(rowsum, -0.5).flatten()
          d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.0
          d_mat_inv_sqrt = sp.diags(d_inv_sqrt)
  
          # bi_lap = adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)
          bi_lap = d_mat_inv_sqrt.dot(A).dot(d_mat_inv_sqrt)
          return bi_lap.tocoo()
  
      def _si_norm_lap(A):
          # D^{-1}A
          rowsum = np.array(A.sum(1))
  
          d_inv = np.power(rowsum, -1).flatten()
          d_inv[np.isinf(d_inv)] = 0.0
          d_mat_inv = sp.diags(d_inv)
  
          norm_adj = d_mat_inv.dot(A)
          return norm_adj.tocoo()
  
      # build adj matrix
      A = sp.dok_matrix(
          (
              self.n_users + self.n_entities,
              self.n_users + self.n_entities,
          ),
          dtype=np.float32,
      )
      inter_M = self.inter_matrix
      inter_M_t = self.inter_matrix.transpose()
      data_dict = dict(
          zip(
              zip(inter_M.row, inter_M.col + self.n_users),
              [1] * inter_M.nnz,
          )
      )
      data_dict.update(
          dict(
              zip(
                  zip(inter_M_t.row + self.n_users, inter_M_t.col),
                  [1] * inter_M_t.nnz,
              )
          )
      )
      A._update(data_dict)
      # norm adj matrix
      if mode == "bi":
          L = _bi_norm_lap(A)
      elif mode == "si":
          L = _si_norm_lap(A)
      else:
          raise NotImplementedError(
              f"Normalize mode [{mode}] has not been implemented."
          )
      # covert norm_inter_graph to tensor
      i = torch.LongTensor(np.array([L.row, L.col]))
      data = torch.FloatTensor(L.data)
      norm_graph = torch.sparse.FloatTensor(i, data, L.shape)
  
      # interaction: user->item, [n_users, n_entities]
      L_ = L.tocsr()[: self.n_users, self.n_users :].tocoo()
      # covert norm_inter_matrix to tensor
      i_ = torch.LongTensor(np.array([L_.row, L_.col]))
      data_ = torch.FloatTensor(L_.data)
      norm_matrix = torch.sparse.FloatTensor(i_, data_, L_.shape)
  
      return norm_matrix.to(self.device), norm_graph.to(self.device)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import scipy.sparse
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_uniform_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 KGIN obj's underlying member method code with example usage: obj.get_norm_inter_matrix(mode) and returns: norm_matrix,  norm_graph, bi_lap, norm_adj