class_docstr: GCSAN captures rich local dependencies via graph neural network,
   and learns long-range dependencies by applying the self-attention mechanism.
  
  Note:
  
      In the original paper, the attention mechanism in the self-attention layer is a single head,
      for the reusability of the project code, we use a unified transformer component.
      According to the experimental results, we only applied regularization to embedding.
class_docstr_tok: ["GCSAN","captures","rich","local","dependencies","via","graph","neural","network",",","and","learns","long-range","dependencies","by","applying","the","self-attention","mechanism",".","Note",":","In","the","original","paper",",","the","attention","mechanism","in","the","self-attention","layer","is","a","single","head",",","for","the","reusability","of","the","project","code",",","we","use","a","unified","transformer","component",".","According","to","the","experimental","results",",","we","only","applied","regularization","to","embedding","."]
code: def __init__(self, config, dataset):
      super(GCSAN, self).__init__(config, dataset)
  
      # load parameters info
      self.n_layers = config["n_layers"]
      self.n_heads = config["n_heads"]
      self.hidden_size = config["hidden_size"]  # same as embedding_size
      self.inner_size = config[
          "inner_size"
      ]  # the dimensionality in feed-forward layer
      self.hidden_dropout_prob = config["hidden_dropout_prob"]
      self.attn_dropout_prob = config["attn_dropout_prob"]
      self.hidden_act = config["hidden_act"]
      self.layer_norm_eps = config["layer_norm_eps"]
  
      self.step = config["step"]
      self.device = config["device"]
      self.weight = config["weight"]
      self.reg_weight = config["reg_weight"]
      self.loss_type = config["loss_type"]
      self.initializer_range = config["initializer_range"]
  
      # define layers and loss
      self.item_embedding = nn.Embedding(
          self.n_items, self.hidden_size, padding_idx=0
      )
      self.gnn = GNN(self.hidden_size, self.step)
      self.self_attention = TransformerEncoder(
          n_layers=self.n_layers,
          n_heads=self.n_heads,
          hidden_size=self.hidden_size,
          inner_size=self.inner_size,
          hidden_dropout_prob=self.hidden_dropout_prob,
          attn_dropout_prob=self.attn_dropout_prob,
          hidden_act=self.hidden_act,
          layer_norm_eps=self.layer_norm_eps,
      )
      self.reg_loss = EmbLoss()
      if self.loss_type == "BPR":
          self.loss_fct = BPRLoss()
      elif self.loss_type == "CE":
          self.loss_fct = nn.CrossEntropyLoss()
      else:
          raise NotImplementedError(
              "Make sure 'loss_type' in ['BPR', 'CE']!"
          )
  
      # parameters initialization
      self.apply(self._init_weights)
  
imports: import math
  import numpy
  import torch
  from torch import nn
  from torch.nn import Parameter
  from torch.nn import functional
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.layers import TransformerEncoder
  from recbole.model.loss import EmbLoss, BPRLoss
label_desc: Use image node_id 1 to create a new GCSAN object from inherited base classes: SequentialRecommender with example: obj = GCSAN(config, dataset)