class_docstr: CORE is a simple and effective framewor, which unifies the representation spac
  for both the encoding and decoding processes in session-based recommendation.
class_docstr_tok: ["CORE","is","a","simple","and","effective","framewor",",","which","unifies","the","representation","spac","for","both","the","encoding","and","decoding","processes","in","session-based","recommendation","."]
code: def calculate_loss(self, interaction):
      item_seq = interaction[self.ITEM_SEQ]
      seq_output = self.forward(item_seq)
      pos_items = interaction[self.POS_ITEM_ID]
  
      all_item_emb = self.item_embedding.weight
      all_item_emb = self.item_dropout(all_item_emb)
      # Robust Distance Measuring (RDM)
      all_item_emb = F.normalize(all_item_emb, dim=-1)
      logits = (
          torch.matmul(seq_output, all_item_emb.transpose(0, 1))
          / self.temperature
      )
      loss = self.loss_fct(logits, pos_items)
      return loss
  
imports: import numpy
  import torch
  from torch import nn
  import torch.nn.functional
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.layers import TransformerEncoder
label_desc: Use image node_id 5 for calling the CORE obj's underlying member method code with example usage: obj.calculate_loss(interaction) and returns: loss