class_docstr: This is an extension of SASRec, which concatenates item representations and item attribute representations
  as the input to the model.
class_docstr_tok: ["This","is","an","extension","of","SASRec",",","which","concatenates","item","representations","and","item","attribute","representations","as","the","input","to","the","model","."]
code: def forward(self, item_seq, item_seq_len):
      item_emb = self.item_embedding(item_seq)
  
      # position embedding
      position_ids = torch.arange(
          item_seq.size(1), dtype=torch.long, device=item_seq.device
      )
      position_ids = position_ids.unsqueeze(0).expand_as(item_seq)
      position_embedding = self.position_embedding(position_ids)
  
      sparse_embedding, dense_embedding = self.feature_embed_layer(
          None, item_seq
      )
      sparse_embedding = sparse_embedding["item"]
      dense_embedding = dense_embedding["item"]
      # concat the sparse embedding and float embedding
      feature_table = []
      if sparse_embedding is not None:
          feature_table.append(sparse_embedding)
      if dense_embedding is not None:
          feature_table.append(dense_embedding)
  
      feature_table = torch.cat(feature_table, dim=-2)
      table_shape = feature_table.shape
      feat_num, embedding_size = table_shape[-2], table_shape[-1]
      feature_emb = feature_table.view(
          table_shape[:-2] + (feat_num * embedding_size,)
      )
      input_concat = torch.cat(
          (item_emb, feature_emb), -1
      )  # [B 1+field_num*H]
  
      input_emb = self.concat_layer(input_concat)
      input_emb = input_emb + position_embedding
      input_emb = self.LayerNorm(input_emb)
      input_emb = self.dropout(input_emb)
  
      extended_attention_mask = self.get_attention_mask(item_seq)
      trm_output = self.trm_encoder(
          input_emb,
          extended_attention_mask,
          output_all_encoded_layers=True,
      )
      output = trm_output[-1]
      seq_output = self.gather_indexes(output, item_seq_len - 1)
      return seq_output
  
file_path: RecBole/recbole/model/sequential_recommender/sasrecf.py
imports: import torch
  from torch import nn
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.layers import TransformerEncoder, FeatureSeqEmbLayer
  from recbole.model.loss import BPRLoss
  from recbole.utils import FeatureType
label_desc: Use image node_id 3 for calling the SASRecF obj's underlying member method code with example usage: obj.forward(item_seq, item_seq_len) and returns: seq_output