class_docstr: Graph Convolutional Encoder
  GcEncoder take as input an :math:`N \times D` feature matrix :math:`X` and a graph adjacency matrix :math:`A`,
  and produce an :math:`N \times E` node embedding matrix;
  Note that :math:`N` denotes the number of nodes, :math:`D` the number of input features,
  and :math:`E` the embedding size.
class_docstr_tok: ["Graph","Convolutional","Encoder","GcEncoder","take","as","input","an",":","math",":","`","N","\\times","D","`","feature","matrix",":","math",":","`","X","`","and","a","graph","adjacency","matrix",":","math",":","`","A","`",",","and","produce","an",":","math",":","`","N","\\times","E","`","node","embedding","matrix",";","Note","that",":","math",":","`","N","`","denotes","the","number","of","nodes",",",":","math",":","`","D","`","the","number","of","input","features",",","and",":","math",":","`","E","`","the","embedding","size","."]
code: def __init__(
      self,
      accum,
      num_user,
      num_item,
      support,
      input_dim,
      gcn_output_dim,
      dense_output_dim,
      drop_prob,
      device,
      sparse_feature=True,
      act_dense=lambda x: x,
      share_user_item_weights=True,
      bias=False,
  ):
      super(GcEncoder, self).__init__()
      self.num_users = num_user
      self.num_items = num_item
      self.input_dim = input_dim
      self.gcn_output_dim = gcn_output_dim
      self.dense_output_dim = dense_output_dim
      self.accum = accum
      self.sparse_feature = sparse_feature
  
      self.device = device
      self.dropout_prob = drop_prob
      self.dropout = nn.Dropout(p=self.dropout_prob)
      if self.sparse_feature:
          self.sparse_dropout = SparseDropout(p=self.dropout_prob)
      else:
          self.sparse_dropout = nn.Dropout(p=self.dropout_prob)
  
      self.dense_activate = act_dense
      self.activate = nn.ReLU()
      self.share_weights = share_user_item_weights
      self.bias = bias
  
      self.support = support
      self.num_support = len(support)
  
      # gcn layer
      if self.accum == "sum":
          self.weights_u = nn.ParameterList(
              [
                  nn.Parameter(
                      torch.FloatTensor(
                          self.input_dim, self.gcn_output_dim
                      ).to(self.device),
                      requires_grad=True,
                  )
                  for _ in range(self.num_support)
              ]
          )
          if share_user_item_weights:
              self.weights_v = self.weights_u
          else:
              self.weights_v = nn.ParameterList(
                  [
                      nn.Parameter(
                          torch.FloatTensor(
                              self.input_dim, self.gcn_output_dim
                          ).to(self.device),
                          requires_grad=True,
                      )
                      for _ in range(self.num_support)
                  ]
              )
      else:
          assert (
              self.gcn_output_dim % self.num_support == 0
          ), "output_dim must be multiple of num_support for stackGC"
          self.sub_hidden_dim = self.gcn_output_dim // self.num_support
  
          self.weights_u = nn.ParameterList(
              [
                  nn.Parameter(
                      torch.FloatTensor(
                          self.input_dim, self.sub_hidden_dim
                      ).to(self.device),
                      requires_grad=True,
                  )
                  for _ in range(self.num_support)
              ]
          )
          if share_user_item_weights:
              self.weights_v = self.weights_u
          else:
              self.weights_v = nn.ParameterList(
                  [
                      nn.Parameter(
                          torch.FloatTensor(
                              self.input_dim, self.sub_hidden_dim
                          ).to(self.device),
                          requires_grad=True,
                      )
                      for _ in range(self.num_support)
                  ]
              )
  
      # dense layer
      self.dense_layer_u = nn.Linear(
          self.gcn_output_dim, self.dense_output_dim, bias=self.bias
      )
      if share_user_item_weights:
          self.dense_layer_v = self.dense_layer_u
      else:
          self.dense_layer_v = nn.Linear(
              self.gcn_output_dim, self.dense_output_dim, bias=self.bias
          )
  
      self._init_weights()
  
imports: import math
  import numpy
  import scipy.sparse
  import torch
  import torch.nn
  from recbole.model.abstract_recommender import GeneralRecommender
  from recbole.model.layers import SparseDropout
  from recbole.utils import InputType
label_desc: Use image node_id 1 to create a new GcEncoder object from inherited base classes: nn with example: obj = GcEncoder(accum, num_user, num_item, support, input_dim, gcn_output_dim, dense_output_dim, drop_prob, device, sparse_feature, act_dense, share_user_item_weights, bias)