code: def test_PairwiseLoss():
      lossObj = PairwiseLoss({"margin": 2, "reduction": "mean"})
      assert (
          lossObj._loss_parameters["margin"] == 2
      ), "PairwiseLoss: The internal states dont match the inputs"
      pos_score = tf.constant([10.0, 100.0], dtype=tf.float32)
      corr_score = tf.constant(
          [10.0, 100.0, 12.0, 102.0, 8.0, 98.0], dtype=tf.float32
      )
      # Loss: 2, 2, 4, 4, 0, 0
      loss = lossObj(pos_score, corr_score, eta=3)
      assert (
          loss.numpy()
          > np.sum(np.array([2.0, 2.0], dtype=np.float32)) - 1e-4
      ).all() and (
          loss.numpy()
          < np.sum(np.array([2.0, 2.0], dtype=np.float32)) + 1e-4
      ).all(), "PairwiseLoss: Loss function outputs dont match expected outputs"
  
      lossObj = PairwiseLoss({"margin": 2, "reduction": "sum"})
      assert (
          lossObj._loss_parameters["margin"] == 2
      ), "PairwiseLoss: The internal states dont match the inputs"
      pos_score = tf.constant([10.0, 100.0], dtype=tf.float32)
      corr_score = tf.constant(
          [10.0, 100.0, 12.0, 102.0, 8.0, 98.0], dtype=tf.float32
      )
      # Loss: 2, 2, 4, 4, 0, 0
      loss = lossObj(pos_score, corr_score, eta=3)
      assert (
          loss.numpy()
          > np.sum(np.array([6.0, 6.0], dtype=np.float32)) - 1e-4
      ).all() and (
          loss.numpy()
          < np.sum(np.array([6.0, 6.0], dtype=np.float32)) + 1e-4
      ).all(), "PairwiseLoss: Loss function outputs dont match expected outputs"
  
file_path: AmpliGraph/tests/ampligraph/latent_features/test_loss_functions.py
imports: from ampligraph.latent_features import loss_functions
  from ampligraph.latent_features.loss_functions import PairwiseLoss, NLLLoss, AbsoluteMarginLoss, SelfAdversarialLoss, NLLMulticlass
  import pytest
  import tensorflow
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: test_PairwiseLoss() without return types