code: def __init__(
      self,
      num_bases,
      num_rel,
      num_ent,
      in_dim=100,
      layer_size=[200],
      comp_fn="sub",
      batchnorm=True,
      dropout=0.1,
      layer_dropout=[0.3],
  ):
      super(CompGCN, self).__init__()
  
      self.num_bases = num_bases
      self.num_rel = num_rel
      self.num_ent = num_ent
      self.in_dim = in_dim
      self.layer_size = layer_size
      self.comp_fn = comp_fn
      self.batchnorm = batchnorm
      self.dropout = dropout
      self.layer_dropout = layer_dropout
      self.num_layer = len(layer_size)
  
      # CompGCN layers
      self.layers = nn.ModuleList()
      self.layers.append(
          CompGraphConv(
              self.in_dim,
              self.layer_size[0],
              comp_fn=self.comp_fn,
              batchnorm=self.batchnorm,
              dropout=self.dropout,
          )
      )
      for i in range(self.num_layer - 1):
          self.layers.append(
              CompGraphConv(
                  self.layer_size[i],
                  self.layer_size[i + 1],
                  comp_fn=self.comp_fn,
                  batchnorm=self.batchnorm,
                  dropout=self.dropout,
              )
          )
  
      # Initial relation embeddings
      if self.num_bases > 0:
          self.basis = nn.Parameter(
              th.Tensor(self.num_bases, self.in_dim)
          )
          self.weights = nn.Parameter(
              th.Tensor(self.num_rel, self.num_bases)
          )
          nn.init.xavier_normal_(self.basis)
          nn.init.xavier_normal_(self.weights)
      else:
          self.rel_embds = nn.Parameter(
              th.Tensor(self.num_rel, self.in_dim)
          )
          nn.init.xavier_normal_(self.rel_embds)
  
      # Node embeddings
      self.n_embds = nn.Parameter(th.Tensor(self.num_ent, self.in_dim))
      nn.init.xavier_normal_(self.n_embds)
  
      # Dropout after compGCN layers
      self.dropouts = nn.ModuleList()
      for i in range(self.num_layer):
          self.dropouts.append(nn.Dropout(self.layer_dropout[i]))
  
file_path: dgl/examples/pytorch/compGCN/models.py
imports: import dgl
  import dgl.function
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from utils import ccorr
label_desc: Use image node_id 1 to create a new CompGCN object from inherited base classes: nn with example: obj = CompGCN(num_bases, num_rel, num_ent, in_dim, layer_size, comp_fn, batchnorm, dropout, layer_dropout)