class_docstr: DistMult scoring layer.
  
  The model as described in :cite:`yang2014embedding`.
  
  The bilinear diagonal DistMult model uses the trilinear dot product as scoring function:
  
  .. math::
      f_{DistMult}=\langle \mathbf{r}_p, \mathbf{e}_s, \mathbf{e}_o \rangle
  
  where :math:`\mathbf{e}_{s}` is the embedding of the subject, :math:`\mathbf{r}_{p}` the embedding
  of the predicate and :math:`\mathbf{e}_{o}` the embedding of the object.
docstr: Compute subject corruption scores.
  
  Evaluate the inputs against subject corruptions and scores of the corruptions.
  
  Parameters
  ----------
  triples: array-like, shape (n, k)
      Batch of input embeddings.
  ent_matrix: array-like, shape (m, k)
      Slice of embedding matrix (corruptions).
  
  Returns
  -------
  scores: tf.Tensor, shape (n, 1)
      Scores of subject corruptions (corruptions defined by `ent_embs` matrix).
code: def _get_subject_corruption_scores(self, triples, ent_matrix):
      """Compute subject corruption scores.
  
      Evaluate the inputs against subject corruptions and scores of the corruptions.
  
      Parameters
      ----------
      triples: array-like, shape (n, k)
          Batch of input embeddings.
      ent_matrix: array-like, shape (m, k)
          Slice of embedding matrix (corruptions).
  
      Returns
      -------
      scores: tf.Tensor, shape (n, 1)
          Scores of subject corruptions (corruptions defined by `ent_embs` matrix).
      """
      rel_emb, obj_emb = triples[1], triples[2]
      # compute the score by broadcasting the corruption embeddings(ent_matrix) and using the scoring function
      # compute scores as sum(s_corr * p * o)
      sub_corr_score = tf.reduce_sum(
          ent_matrix * tf.expand_dims(rel_emb * obj_emb, 1), 2
      )
      return sub_corr_score
  
file_path: AmpliGraph/ampligraph/latent_features/layers/scoring/DistMult.py
imports: import tensorflow
  from .AbstractScoringLayer import register_layer, AbstractScoringLayer
label_desc: Use image node_id 4 for calling the DistMult obj's underlying member method code with example usage: obj._get_subject_corruption_scores(triples, ent_matrix) and returns: sub_corr_score