code: def test_custom_loss_ivis_callable(model_filepath):
      iris = datasets.load_iris()
      X = iris.data
  
      class EuclideanDistance:
          def __init__(self, margin=1):
              self.margin = margin
              self.__name__ = self.__class__.__name__
  
          def _euclidean_distance(self, x, y):
              return K.sqrt(
                  K.maximum(
                      K.sum(K.square(x - y), axis=-1, keepdims=True),
                      K.epsilon(),
                  )
              )
  
          def __call__(self, y_true, y_pred):
              anchor, positive, negative = tf.unstack(y_pred)
              return K.mean(
                  K.maximum(
                      self._euclidean_distance(anchor, positive)
                      - self._euclidean_distance(anchor, negative)
                      + self.margin,
                      0,
                  )
              )
  
      model = Ivis(
          distance=EuclideanDistance(margin=2),
          k=15,
          batch_size=16,
          epochs=5,
      )
      y_pred = model.fit_transform(X)
  
      # Test model saving and loading
      model.save_model(model_filepath, overwrite=True)
      model_2 = Ivis(distance=EuclideanDistance(margin=2))
      model_2.load_model(model_filepath)
      model_2.fit(X)
  
file_path: ivis/tests/nn/test_losses.py
imports: import tempfile
  import os
  import pytest
  from sklearn import datasets
  from tensorflow.keras import backend
  import tensorflow
  from ivis.nn import losses
  from ivis.nn.distances import euclidean_distance
  from ivis import Ivis
label_desc: Use image node_id 5 for calling a global function with example usage: test_custom_loss_ivis_callable(model_filepath) and returns: K, K