class_docstr: DGCF is a disentangled representation enhanced matrix factorization model.
  The interaction matrix of :math:`n_{users} \times n_{items}` is decomposed to :math:`n_{factors}` intent graph,
  we carefully design the data interface and use sparse tensor to train and test efficiently.
  We implement the model following the original author with a pairwise training mode.
docstr: Get the normalized interaction matrix of users and items according to A_values.
  
  Construct the square matrix from the training data and normalize it
  using the laplace matrix.
  
  Args:
      A_values (torch.cuda.FloatTensor): (num_edge, n_factors)
  
  .. math::
      A_{hat} = D^{-0.5} \times A \times D^{-0.5}
  
  Returns:
      torch.cuda.FloatTensor: Sparse tensor of the normalized interaction matrix. shape: (num_edge, n_factors)
docstr_tok: ["Get","the","normalized","interaction","matrix","of","users","and","items","according","to","A_values",".","Construct","the","square","matrix","from","the","training","data","and","normalize","it","using","the","laplace","matrix",".","Args",":","A_values","(","torch.cuda.FloatTensor",")",":","(","num_edge",",","n_factors",")","..","math",":",":","A_","{","hat","}","=","D^","{","-0.5","}","\\times","A","\\times","D^","{","-0.5","}","Returns",":","torch.cuda.FloatTensor",":","Sparse","tensor","of","the","normalized","interaction","matrix",".","shape",":","(","num_edge",",","n_factors",")"]
code: def build_matrix(self, A_values):
      r"""Get the normalized interaction matrix of users and items according to A_values.
  
      Construct the square matrix from the training data and normalize it
      using the laplace matrix.
  
      Args:
          A_values (torch.cuda.FloatTensor): (num_edge, n_factors)
  
      .. math::
          A_{hat} = D^{-0.5} \times A \times D^{-0.5}
  
      Returns:
          torch.cuda.FloatTensor: Sparse tensor of the normalized interaction matrix. shape: (num_edge, n_factors)
      """
      norm_A_values = self.softmax(A_values)
      factor_edge_weight = []
      for i in range(self.n_factors):
          tp_values = norm_A_values[:, i].unsqueeze(1)
          # (num_edge, 1)
          d_values = torch.sparse.mm(self.edge2head_mat, tp_values)
          # (num_node, num_edge) (num_edge, 1) -> (num_node, 1)
          d_values = torch.clamp(d_values, min=1e-8)
          try:
              assert not torch.isnan(d_values).any()
          except AssertionError:
              self.logger.info(
                  "d_values", torch.min(d_values), torch.max(d_values)
              )
  
          d_values = 1.0 / torch.sqrt(d_values)
          head_term = torch.sparse.mm(self.head2edge_mat, d_values)
          # (num_edge, num_node) (num_node, 1) -> (num_edge, 1)
  
          tail_term = torch.sparse.mm(self.tail2edge_mat, d_values)
          edge_weight = tp_values * head_term * tail_term
          factor_edge_weight.append(edge_weight)
      return factor_edge_weight
  
imports: import random
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
  from recbole.model.abstract_recommender import GeneralRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.loss import BPRLoss, EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 4 for calling the DGCF obj's underlying member method code with example usage: obj.build_matrix(A_values) and returns: factor_edge_weight