code: def __init__(self, g, in_size, layer_size, dropout, lmbd=1e-5):
      super(NGCF, self).__init__()
      self.lmbd = lmbd
      self.norm_dict = dict()
      for srctype, etype, dsttype in g.canonical_etypes:
          src, dst = g.edges(etype=(srctype, etype, dsttype))
          dst_degree = g.in_degrees(
              dst, etype=(srctype, etype, dsttype)
          ).float()  # obtain degrees
          src_degree = g.out_degrees(
              src, etype=(srctype, etype, dsttype)
          ).float()
          norm = torch.pow(src_degree * dst_degree, -0.5).unsqueeze(
              1
          )  # compute norm
          self.norm_dict[(srctype, etype, dsttype)] = norm
  
      self.layers = nn.ModuleList()
      self.layers.append(
          NGCFLayer(in_size, layer_size[0], self.norm_dict, dropout[0])
      )
      self.num_layers = len(layer_size)
      for i in range(self.num_layers - 1):
          self.layers.append(
              NGCFLayer(
                  layer_size[i],
                  layer_size[i + 1],
                  self.norm_dict,
                  dropout[i + 1],
              )
          )
      self.initializer = nn.init.xavier_uniform_
  
      # embeddings for different types of nodes
      self.feature_dict = nn.ParameterDict(
          {
              ntype: nn.Parameter(
                  self.initializer(
                      torch.empty(g.num_nodes(ntype), in_size)
                  )
              )
              for ntype in g.ntypes
          }
      )
  
file_path: dgl/examples/pytorch/NGCF/NGCF/model.py
imports: import dgl.function
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 1 to create a new NGCF object from inherited base classes: nn with example: obj = NGCF(g, in_size, layer_size, dropout, lmbd)