code: def model_save_load(tmpdir, sg_model):
      model = tf.keras.Model(*sg_model.in_out_tensors())
  
      saving_functions = [
          tf.keras.models.save_model,
          tf.keras.Model.save,
          tf.saved_model.save,
      ]
      loading_functions = [
          tf.keras.models.load_model,
          # tf.saved_model.load doesn't restore the Keras Model object
      ]
  
      for i, func in enumerate(saving_functions):
          saved_dir = str(tmpdir.join(str(i)))
          func(model, str(saved_dir))
  
          for func in loading_functions:
              loaded = func(saved_dir, sg.custom_keras_layers)
  
              orig_weights = model.get_weights()
              new_weights = loaded.get_weights()
              assert len(orig_weights) == len(new_weights)
              for orig, new in zip(orig_weights, new_weights):
                  np.testing.assert_array_equal(orig, new)
  
      # clear the tensorflow session to free memory
      tf.keras.backend.clear_session()
  
imports: import pytest
  import tensorflow
  import stellargraph
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: model_save_load(tmpdir, sg_model) without return types