class_docstr: KTUP is a knowledge-based recommendation model. It adopts the strategy of multi-task learning to jointly learn
  recommendation and KG-related tasks, with the goal of understanding the reasons that a user interacts with an item.
  This method utilizes an attention mechanism to combine all preferences into a single-vector representation.
code: def __init__(self, config, dataset):
      super(KTUP, self).__init__(config, dataset)
  
      # load parameters info
      self.embedding_size = config["embedding_size"]
      self.L1_flag = config["L1_flag"]
      self.use_st_gumbel = config["use_st_gumbel"]
      self.kg_weight = config["kg_weight"]
      self.align_weight = config["align_weight"]
      self.margin = config["margin"]
  
      # define layers and loss
      self.user_embedding = nn.Embedding(
          self.n_users, self.embedding_size
      )
      self.item_embedding = nn.Embedding(
          self.n_items, self.embedding_size
      )
      self.pref_embedding = nn.Embedding(
          self.n_relations, self.embedding_size
      )
      self.pref_norm_embedding = nn.Embedding(
          self.n_relations, self.embedding_size
      )
      self.entity_embedding = nn.Embedding(
          self.n_entities, self.embedding_size
      )
      self.relation_embedding = nn.Embedding(
          self.n_relations, self.embedding_size
      )
      self.relation_norm_embedding = nn.Embedding(
          self.n_relations, self.embedding_size
      )
  
      self.rec_loss = BPRLoss()
      self.kg_loss = nn.MarginRankingLoss(margin=self.margin)
      self.reg_loss = EmbMarginLoss()
  
      # parameters initialization
      self.apply(xavier_uniform_initialization)
      normalize_user_emb = F.normalize(
          self.user_embedding.weight.data, p=2, dim=1
      )
      normalize_item_emb = F.normalize(
          self.item_embedding.weight.data, p=2, dim=1
      )
      normalize_pref_emb = F.normalize(
          self.pref_embedding.weight.data, p=2, dim=1
      )
      normalize_pref_norm_emb = F.normalize(
          self.pref_norm_embedding.weight.data, p=2, dim=1
      )
      normalize_entity_emb = F.normalize(
          self.entity_embedding.weight.data, p=2, dim=1
      )
      normalize_rel_emb = F.normalize(
          self.relation_embedding.weight.data, p=2, dim=1
      )
      normalize_rel_norm_emb = F.normalize(
          self.relation_norm_embedding.weight.data, p=2, dim=1
      )
      self.user_embedding.weight.data = normalize_user_emb
      self.item_embedding.weight_data = normalize_item_emb
      self.pref_embedding.weight.data = normalize_pref_emb
      self.pref_norm_embedding.weight.data = normalize_pref_norm_emb
      self.entity_embedding.weight.data = normalize_entity_emb
      self.relation_embedding.weight.data = normalize_rel_emb
      self.relation_norm_embedding.weight.data = normalize_rel_norm_emb
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_uniform_initialization
  from recbole.model.loss import BPRLoss, EmbMarginLoss
  from recbole.utils import InputType
label_desc: Use image node_id 1 to create a new KTUP object from inherited base classes: KnowledgeRecommender with example: obj = KTUP(config, dataset)