class_docstr: AFM is a attention based FM model that predict the final score with the attention of input feature.
class_docstr_tok: ["AFM","is","a","attention","based","FM","model","that","predict","the","final","score","with","the","attention","of","input","feature","."]
code: def calculate_loss(self, interaction):
      label = interaction[self.LABEL]
  
      output = self.forward(interaction)
      l2_loss = self.reg_weight * torch.norm(
          self.attlayer.w.weight, p=2
      )
      return self.loss(output, label) + l2_loss
  
file_path: RecBole/recbole/model/context_aware_recommender/afm.py
imports: import torch
  import torch.nn
  from torch.nn.init import xavier_normal_, constant_
  from recbole.model.abstract_recommender import ContextRecommender
  from recbole.model.layers import AttLayer
label_desc: Use image node_id 6 for calling the AFM obj's underlying member method code with example usage: obj.calculate_loss(interaction) and returns: unknown