code: def test_AbsoluteMarginLoss():
      lossObj = AbsoluteMarginLoss({"margin": 3, "reduction": "mean"})
      assert (
          lossObj._loss_parameters["margin"] == 3
      ), "AbsoluteMarginLoss: The internal states dont match the inputs"
  
      pos_score = tf.constant([10.0, -10.0], dtype=tf.float32)
      corr_score = tf.constant(
          [13, -10, 10, -7, 7, -13], dtype=tf.float32
      )
      # Loss: 6, 10, 3, 10, 0, 10
      loss = lossObj(pos_score, corr_score, eta=3)
      assert (
          loss.numpy()
          > np.sum(np.array([3.0, 10.0], dtype=np.float32)) - 1e-4
      ).all() and (
          loss.numpy()
          < np.sum(np.array([3.0, 10.0], dtype=np.float32)) + 1e-4
      ).all(), "AbsoluteMarginLoss: Loss function outputs dont match expected outputs"
  
      lossObj = AbsoluteMarginLoss({"margin": 3, "reduction": "sum"})
      assert (
          lossObj._loss_parameters["margin"] == 3
      ), "AbsoluteMarginLoss: The internal states dont match the inputs"
  
      pos_score = tf.constant([10.0, -10.0], dtype=tf.float32)
      corr_score = tf.constant(
          [13, -10, 10, -7, 7, -13], dtype=tf.float32
      )
      # Loss: 6, 10, 3, 10, 0, 10
      loss = lossObj(pos_score, corr_score, eta=3)
      assert (
          loss.numpy()
          > np.sum(np.array([9.0, 30.0], dtype=np.float32)) - 1e-4
      ).all() and (
          loss.numpy()
          < np.sum(np.array([9.0, 30.0], dtype=np.float32)) + 1e-4
      ).all(), (
          "NLLLoss: 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 3 for calling a global function with example usage: test_AbsoluteMarginLoss() without return types