class_docstr: Complex Embeddings (ComplEx) scoring layer.
  
  The ComplEx model :cite:`trouillon2016complex` is an extension of
  the :class:`ampligraph.latent_features.DistMult` bilinear diagonal model.
  
  ComplEx scoring function is based on the trilinear Hermitian dot product in :math:`\mathbb{C}`:
  
  .. math::
      f_{ComplEx}=Re(\langle \mathbf{r}_p, \mathbf{e}_s, \overline{\mathbf{e}_o}  \rangle)
  
  .. note::
      Since ComplEx embeddings belong to :math:`\mathbb{C}`, this model uses twice as many parameters as
      :class:`ampligraph.latent_features.DistMult`.
docstr: Compute scores using the ComplEx scoring function.
  
  Parameters
  ----------
  triples: array, shape (n, 3)
      Batch of input triples.
  
  Returns
  -------
  scores: tf.Tensor
      Tensor with scores of the inputs.
code: def _compute_scores(self, triples):
      """Compute scores using the ComplEx scoring function.
  
      Parameters
      ----------
      triples: array, shape (n, 3)
          Batch of input triples.
  
      Returns
      -------
      scores: tf.Tensor
          Tensor with scores of the inputs.
      """
      # split the embeddings of s, p, o into 2 parts (real and img part)
      e_s_real, e_s_img = tf.split(triples[0], 2, axis=1)
      e_p_real, e_p_img = tf.split(triples[1], 2, axis=1)
      e_o_real, e_o_img = tf.split(triples[2], 2, axis=1)
  
      # apply the complex scoring function
      scores = tf.reduce_sum(
          (e_s_real * (e_p_real * e_o_real + e_p_img * e_o_img))
          + (e_s_img * (e_p_real * e_o_img - e_p_img * e_o_real)),
          axis=1,
      )
      return scores
  
file_path: AmpliGraph/ampligraph/latent_features/layers/scoring/ComplEx.py
imports: import tensorflow
  from .AbstractScoringLayer import register_layer, AbstractScoringLayer
label_desc: Use image node_id 3 for calling the ComplEx obj's underlying member method code with example usage: obj._compute_scores(triples) and returns: scores