code: def _custom_model_saving(model_filepath, save_fn, load_fn):
      iris = datasets.load_iris()
      X = iris.data
      Y = iris.target
  
      # Create a custom model
      inputs = tf.keras.layers.Input(shape=(X.shape[-1],))
      x = tf.keras.layers.Dense(8, activation="relu")(inputs)
      custom_model = tf.keras.Model(inputs, x)
  
      model = Ivis(k=15, batch_size=16, epochs=2, model=custom_model)
  
      model.fit(X, Y)
      save_fn(model, model_filepath)
      model_2 = load_fn(model_filepath)
  
      # Check that model embeddings are same
      assert np.all(model.transform(X) == model_2.transform(X))
      # Check that model supervised predictions are same
      assert np.all(model.score_samples(X) == model_2.score_samples(X))
  
      _validate_network_equality(model, model_2)
  
      # Train new model
      y_pred_2 = model_2.fit_transform(X, Y)
  
imports: import os
  import tempfile
  import pytest
  import pickle
  import dill
  from functools import partial
  from sklearn import datasets
  import numpy
  import tensorflow
  from ivis import Ivis
label_desc: Use image node_id 5 for calling a global function with example usage: _custom_model_saving(model_filepath, save_fn, load_fn) without return types