code: def test_neumf_save_load(n_users, n_items):
      model_type = "gmf"
      ckpt_gmf = ".%s" % model_type
      if os.path.exists(ckpt_gmf):
          shutil.rmtree(ckpt_gmf)
      model = NCF(
          n_users=n_users,
          n_items=n_items,
          model_type=model_type,
          n_epochs=1,
      )
      model.save(ckpt_gmf)
      P_gmf = model.sess.run(model.embedding_gmf_P)
      Q_gmf = model.sess.run(model.embedding_gmf_Q)
      del model
  
      model_type = "mlp"
      ckpt_mlp = ".%s" % model_type
      if os.path.exists(ckpt_mlp):
          shutil.rmtree(ckpt_mlp)
      model = NCF(
          n_users=n_users,
          n_items=n_items,
          model_type=model_type,
          n_epochs=1,
      )
      model.save(".%s" % model_type)
      P_mlp = model.sess.run(model.embedding_mlp_P)
      Q_mlp = model.sess.run(model.embedding_mlp_Q)
      del model
  
      model_type = "neumf"
      model = NCF(
          n_users=n_users,
          n_items=n_items,
          model_type=model_type,
          n_epochs=1,
      )
      model.load(gmf_dir=ckpt_gmf, mlp_dir=ckpt_mlp)
  
      P_gmf_ = model.sess.run(model.embedding_gmf_P)
      Q_gmf_ = model.sess.run(model.embedding_gmf_Q)
  
      P_mlp_ = model.sess.run(model.embedding_mlp_P)
      Q_mlp_ = model.sess.run(model.embedding_mlp_Q)
  
      assert np.array_equal(P_gmf, P_gmf_)
      assert np.array_equal(Q_gmf, Q_gmf_)
      assert np.array_equal(P_mlp, P_mlp_)
      assert np.array_equal(Q_mlp, Q_mlp_)
  
      if os.path.exists(ckpt_gmf):
          shutil.rmtree(ckpt_gmf)
      if os.path.exists(ckpt_mlp):
          shutil.rmtree(ckpt_mlp)
  
file_path: recommenders/tests/unit/recommenders/models/test_ncf_singlenode.py
imports: import os
  import shutil
  import pytest
  import numpy
  import pandas
label_desc: Use image node_id 3 for calling a global function with example usage: test_neumf_save_load(n_users, n_items) without return types