code: def __init__(
      self, ent_tot, rel_tot, dim=100, margin=None, epsilon=None
  ):
      super(DistMult, self).__init__(ent_tot, rel_tot)
  
      self.dim = dim
      self.margin = margin
      self.epsilon = epsilon
      self.ent_embeddings = nn.Embedding(self.ent_tot, self.dim)
      self.rel_embeddings = nn.Embedding(self.rel_tot, self.dim)
  
      if margin == None or epsilon == None:
          nn.init.xavier_uniform_(self.ent_embeddings.weight.data)
          nn.init.xavier_uniform_(self.rel_embeddings.weight.data)
      else:
          self.embedding_range = nn.Parameter(
              torch.Tensor([(self.margin + self.epsilon) / self.dim]),
              requires_grad=False,
          )
          nn.init.uniform_(
              tensor=self.ent_embeddings.weight.data,
              a=-self.embedding_range.item(),
              b=self.embedding_range.item(),
          )
          nn.init.uniform_(
              tensor=self.rel_embeddings.weight.data,
              a=-self.embedding_range.item(),
              b=self.embedding_range.item(),
          )
  
file_path: OpenKE/openke/module/model/DistMult.py
imports: import torch
  import torch.nn
  from .Model import Model
label_desc: Use image node_id 1 to create a new DistMult object from inherited base classes: Model with example: obj = DistMult(ent_tot, rel_tot, dim, margin, epsilon)