class_docstr: NGCF is a model that incorporate GNN for recommendation.
  We implement the model following the original author with a pairwise training mode.
class_docstr_tok: ["NGCF","is","a","model","that","incorporate","GNN","for","recommendation",".","We","implement","the","model","following","the","original","author","with","a","pairwise","training","mode","."]
docstr: Get the normalized interaction matrix of users and items.
  
  Construct the square matrix from the training data and normalize it
  using the laplace matrix.
  
  .. math::
      A_{hat} = D^{-0.5} \times A \times D^{-0.5}
  
  Returns:
      Sparse tensor of the normalized interaction matrix.
docstr_tok: ["Get","the","normalized","interaction","matrix","of","users","and","items",".","Construct","the","square","matrix","from","the","training","data","and","normalize","it","using","the","laplace","matrix",".","..","math",":",":","A_","{","hat","}","=","D^","{","-0.5","}","\\times","A","\\times","D^","{","-0.5","}","Returns",":","Sparse","tensor","of","the","normalized","interaction","matrix","."]
code: def get_norm_adj_mat(self):
      r"""Get the normalized interaction matrix of users and items.
  
      Construct the square matrix from the training data and normalize it
      using the laplace matrix.
  
      .. math::
          A_{hat} = D^{-0.5} \times A \times D^{-0.5}
  
      Returns:
          Sparse tensor of the normalized interaction matrix.
      """
      # build adj matrix
      A = sp.dok_matrix(
          (self.n_users + self.n_items, self.n_users + self.n_items),
          dtype=np.float32,
      )
      inter_M = self.interaction_matrix
      inter_M_t = self.interaction_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
      sumArr = (A > 0).sum(axis=1)
      diag = (
          np.array(sumArr.flatten())[0] + 1e-7
      )  # add epsilon to avoid divide by zero Warning
      diag = np.power(diag, -0.5)
      D = sp.diags(diag)
      L = D * A * D
      # covert norm_adj matrix to tensor
      L = sp.coo_matrix(L)
      row = L.row
      col = L.col
      i = torch.LongTensor(np.array([row, col]))
      data = torch.FloatTensor(L.data)
      SparseL = torch.sparse.FloatTensor(i, data, torch.Size(L.shape))
      return SparseL
  
file_path: RecBole/recbole/model/general_recommender/ngcf.py
imports: import numpy
  import scipy.sparse
  import torch
  import torch.nn
  import torch.nn.functional
  from recbole.model.abstract_recommender import GeneralRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.layers import BiGNNLayer, SparseDropout
  from recbole.model.loss import BPRLoss, EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 2 for calling the NGCF obj's underlying member method code with example usage: obj.get_norm_adj_mat() and returns: SparseL