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 forward(self, user, item_seq, item_seq_len):
      # the last item at the last position
      last_items = self.gather_last_items(
          item_seq, item_seq_len - 1
      )  # [B]
      user_emb = self.user_embedding(user)  # [B H]
      last_items_emb = self.item_embedding(last_items)  # [B H]
      T = self.T.expand_as(user_emb)  # [B H]
      seq_output = user_emb + T + last_items_emb  # [B H]
      return seq_output
  
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 4 for calling the TransRec obj's underlying member method code with example usage: obj.forward(user, item_seq, item_seq_len) and returns: seq_output