code: def test_pandas_input_fn_for_saved_model(pd_df, tmp):
      """Test `export_model` and `pandas_input_fn_for_saved_model`"""
      data, users, items = pd_df
      model_dir = os.path.join(tmp, "model")
      export_dir = os.path.join(tmp, "export")
  
      _, deep_columns = build_feature_columns(
          users, items, model_type="deep"
      )
  
      # Train a model
      model = build_model(
          model_dir,
          deep_columns=deep_columns,
      )
      train_fn = pandas_input_fn(
          df=data,
          y_col=DEFAULT_RATING_COL,
          batch_size=1,
          num_epochs=None,
          shuffle=True,
      )
      model.train(input_fn=train_fn, steps=1)
  
      # Test export_model function
      exported_path = export_model(
          model=model,
          train_input_fn=train_fn,
          eval_input_fn=pandas_input_fn(
              df=data, y_col=DEFAULT_RATING_COL
          ),
          tf_feat_cols=deep_columns,
          base_dir=export_dir,
      )
      saved_model = tf.saved_model.load(exported_path, tags="serve")
  
      # Test pandas_input_fn_for_saved_model with the saved model
      test = data.drop(DEFAULT_RATING_COL, axis=1)
      test.reset_index(drop=True, inplace=True)
      list(
          itertools.islice(
              saved_model.signatures["predict"](
                  examples=pandas_input_fn_for_saved_model(
                      df=test,
                      feat_name_type={
                          DEFAULT_USER_COL: int,
                          DEFAULT_ITEM_COL: int,
                          ITEM_FEAT_COL: list,
                      },
                  )()["inputs"]
              ),
              len(test),
          )
      )
  
      # Close the event file so that the model folder can be cleaned up.
      summary_writer = tf.compat.v1.summary.FileWriterCache.get(
          model.model_dir
      )
      summary_writer.close()
  
file_path: recommenders/tests/unit/recommenders/utils/test_tf_utils.py
imports: import os
  import pytest
  import numpy
  import pandas
  import itertools
  from recommenders.utils.constants import DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_RATING_COL, SEED
  from recommenders.evaluation.python_evaluation import rmse
label_desc: Use image node_id 5 for calling a global function with example usage: test_pandas_input_fn_for_saved_model(pd_df, tmp) without return types