class_docstr: TransRec is translation-based model for sequential recommendation.
  It assumes that the `prev. item` + `user`  = `next item`.
  We use the Euclidean Distance to calculate the similarity in this implementation.
class_docstr_tok: ["TransRec","is","translation-based","model","for","sequential","recommendation",".","It","assumes","that","the","`","prev",".","item","`","+","`","user","`","=","`","next","item","`",".","We","use","the","Euclidean","Distance","to","calculate","the","similarity","in","this","implementation","."]
code: def _l2_distance(self, x, y):
      return torch.sqrt(torch.sum((x - y) ** 2, dim=-1, keepdim=True))
  
file_path: RecBole/recbole/model/sequential_recommender/transrec.py
imports: import torch
  from torch import nn
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.loss import BPRLoss, EmbLoss, RegLoss
  from recbole.utils import InputType
label_desc: Use image node_id 2 for calling the TransRec obj's underlying member method code with example usage: obj._l2_distance(x, y) and returns: torch