class_docstr: Collaborative Denoising Auto-Encoder (CDAE) is a recommendation model
  for top-N recommendation that utilizes the idea of Denoising Auto-Encoders.
  We implement the the CDAE model with only user dataloader.
class_docstr_tok: ["Collaborative","Denoising","Auto-Encoder","(","CDAE",")","is","a","recommendation","model","for","top-N","recommendation","that","utilizes","the","idea","of","Denoising","Auto-Encoders",".","We","implement","the","the","CDAE","model","with","only","user","dataloader","."]
code: def calculate_loss(self, interaction):
      x_users = interaction[self.USER_ID]
      x_items = self.get_rating_matrix(x_users)
      predict = self.forward(x_items, x_users)
  
      if self.loss_type == "MSE":
          predict = self.o_act(predict)
          loss_func = nn.MSELoss(reduction="sum")
      elif self.loss_type == "BCE":
          loss_func = nn.BCEWithLogitsLoss(reduction="sum")
      else:
          raise ValueError(
              "Invalid loss_type, loss_type must in [MSE, BCE]"
          )
      loss = loss_func(predict, x_items)
      # l1-regularization
      loss += self.reg_weight_1 * (
          self.h_user.weight.norm(p=1) + self.h_item.weight.norm(p=1)
      )
      # l2-regularization
      loss += self.reg_weight_2 * (
          self.h_user.weight.norm() + self.h_item.weight.norm()
      )
  
      return loss
  
file_path: RecBole/recbole/model/general_recommender/cdae.py
imports: import torch
  import torch.nn
  from recbole.model.abstract_recommender import AutoEncoderMixin, GeneralRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.utils import InputType
label_desc: Use image node_id 3 for calling the CDAE obj's underlying member method code with example usage: obj.calculate_loss(interaction) and returns: loss