class_docstr: RaCT is a collaborative filtering model which uses methods based on actor-critic reinforcement learning for training.
  
  We implement the RaCT model with only user dataloader.
class_docstr_tok: ["RaCT","is","a","collaborative","filtering","model","which","uses","methods","based","on","actor-critic","reinforcement","learning","for","training",".","We","implement","the","RaCT","model","with","only","user","dataloader","."]
code: def calculate_loss(self, interaction):
      # actor_pretrain
      if self.train_stage == "actor_pretrain":
          return self.calculate_actor_loss(interaction).mean()
      # critic_pretrain
      elif self.train_stage == "critic_pretrain":
          return self.calculate_critic_loss(interaction).mean()
      # finetune
      else:
          return self.calculate_ac_loss(interaction).mean()
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import numpy
  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 12 for calling the RaCT obj's underlying member method code with example usage: obj.calculate_loss(interaction) and returns: self, self, self