code: def __init__(
      self,
      user_num,
      item_num,
      factor_num,
      num_layers,
      dropout,
      model,
      GMF_model=None,
      MLP_model=None,
      sparse_feats_input_dims=None,
      sparse_feats_embed_dims=8,
      num_dense_feats=0,
  ):
      super(NCF, self).__init__()
      """
          user_num: number of users;
          item_num: number of items;
          factor_num: number of predictive factors;
          num_layers: the number of layers in MLP model;
          dropout: dropout rate between fully connected layers;
          model: "MLP", "GMF", "NeuMF-end", and "NeuMF-pre";
          GMF_model: pre-trained GMF weights;
          MLP_model: pre-trained MLP weights;
          sparse_feats_input_dims: the list of input dimensions of sparse features;
          sparse_feats_embed_dims: the list of embedding dimensions of sparse features;
          num_dense_feats: number of dense features.
          """
      self.dropout = dropout
      self.model = model
      self.GMF_model = GMF_model
      self.MLP_model = MLP_model
      self.sparse_feats_input_dims = (
          sparse_feats_input_dims
          if sparse_feats_input_dims is not None
          else []
      )
      self.num_dense_feats = num_dense_feats
      self.num_sparse_feats = len(self.sparse_feats_input_dims)
      self.sparse_feats_embed_dims = (
          sparse_feats_embed_dims
          if isinstance(sparse_feats_embed_dims, list)
          else [sparse_feats_embed_dims] * self.num_sparse_feats
      )
  
      self.embed_user_GMF = nn.Embedding(user_num, factor_num)
      self.embed_item_GMF = nn.Embedding(item_num, factor_num)
      self.embed_user_MLP = nn.Embedding(
          user_num, factor_num * (2 ** (num_layers - 1))
      )
      self.embed_item_MLP = nn.Embedding(
          item_num, factor_num * (2 ** (num_layers - 1))
      )
      self.embed_catFeats_MLP = [
          nn.Embedding(
              self.sparse_feats_input_dims[i],
              self.sparse_feats_embed_dims[i],
          )
          for i in range(self.num_sparse_feats)
      ]
  
      input_size = (
          factor_num * (2**num_layers)
          + sum(self.sparse_feats_embed_dims)
          + num_dense_feats
      )
      output_size = factor_num * (2 ** (num_layers - 1))
      MLP_modules = []
      for i in range(num_layers):
          MLP_modules.append(nn.Dropout(p=self.dropout))
          MLP_modules.append(nn.Linear(input_size, output_size))
          MLP_modules.append(nn.ReLU())
          input_size = output_size
          output_size = output_size // 2
  
      self.MLP_layers = nn.Sequential(*MLP_modules)
  
      if self.model in ["MLP", "GMF"]:
          predict_size = factor_num
      else:
          predict_size = factor_num * 2
      self.predict_layer = nn.Linear(predict_size, 1)
  
      self._init_weight_()
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new NCF object from inherited base classes: nn with example: obj = NCF(user_num, item_num, factor_num, num_layers, dropout, model, GMF_model, MLP_model, sparse_feats_input_dims, sparse_feats_embed_dims, num_dense_feats)