class_docstr: Wraps a loss function in the `Loss` class.
  
  Example
  -------
  >>> import ampligraph.latent_features.loss_functions as lfs
  >>> def user_defined_loss(scores_pos, scores_neg):
  >>>    neg_exp = tf.exp(scores_neg)
  >>>    pos_exp = tf.exp(scores_pos)
  >>>    softmax_score = pos_exp / (tf.reduce_sum(neg_exp, axis=0) + pos_exp)
  >>>    loss = -tf.math.log(softmax_score)
  >>>    return loss
  >>> udf_loss = lfs.get(user_defined_loss)
  >>> isinstance(udf_loss, Loss)
  True
  >>> isinstance(udf_loss, LossFunctionWrapper)
  True
class_docstr_tok: ["Wraps","a","loss","function","in","the","`","Loss","`","class",".","Example","--","--","--","-",">",">",">","import","ampligraph.latent_features.loss_functions","as","lfs",">",">",">","def","user_defined_loss","(","scores_pos",",","scores_neg",")",":",">",">",">","neg_exp","=","tf.exp","(","scores_neg",")",">",">",">","pos_exp","=","tf.exp","(","scores_pos",")",">",">",">","softmax_score","=","pos_exp","\/","(","tf.reduce_sum","(","neg_exp",",","axis=0",")","+","pos_exp",")",">",">",">","loss","=","-tf.math.log","(","softmax_score",")",">",">",">","return","loss",">",">",">","udf_loss","=","lfs.get","(","user_defined_loss",")",">",">",">","isinstance","(","udf_loss",",","Loss",")","True",">",">",">","isinstance","(","udf_loss",",","LossFunctionWrapper",")","True"]
docstr: Apply the loss function.
  
  Parameters
  ----------
  scores_pos : tf.Tensor, shape (n, 1)
      A tensor of scores assigned to positive statements.
  scores_neg : tf.Tensor, shape (eta, n)
      A tensor of scores assigned to negative statements.
  
  Returns
  -------
  loss : float
      The loss value that must be minimized.
docstr_tok: ["Apply","the","loss","function",".","Parameters","--","--","--","--","--","scores_pos",":","tf.Tensor",",","shape","(","n",",","1",")","A","tensor","of","scores","assigned","to","positive","statements",".","scores_neg",":","tf.Tensor",",","shape","(","eta",",","n",")","A","tensor","of","scores","assigned","to","negative","statements",".","Returns","--","--","--","-","loss",":","float","The","loss","value","that","must","be","minimized","."]
code: def _apply_loss(self, scores_pos, scores_neg):
      """Apply the loss function.
  
      Parameters
      ----------
      scores_pos : tf.Tensor, shape (n, 1)
          A tensor of scores assigned to positive statements.
      scores_neg : tf.Tensor, shape (eta, n)
          A tensor of scores assigned to negative statements.
  
      Returns
      -------
      loss : float
          The loss value that must be minimized.
  
      """
      return self._user_losses(scores_pos, scores_neg)
  
imports: import abc
  import logging
  import six
  import tensorflow
  from tensorflow.python.keras import metrics
  from tensorflow.python.keras.utils import losses_utils
  from tensorflow.python.ops import math_ops
label_desc: Use image node_id 3 for calling the LossFunctionWrapper obj's underlying member method code with example usage: obj._apply_loss(scores_pos, scores_neg) and returns: self