code: def export_eval_savedmodel_with_feature_metadata(
      estimator,
      export_dir_base: str,
      eval_input_receiver_fn: Callable[
          [], tfma.export.EvalInputReceiverType
      ],
      serving_input_receiver_fn: Optional[
          Callable[[], tf_estimator.export.ServingInputReceiver]
      ] = None,
      assets_extra: Optional[Dict[str, str]] = None,
      checkpoint_path: Optional[str] = None,
  ) -> str:
      """Like tfma.export.export_eval_savedmodel, with extra feature metadata."""
      output_dict = {}
      with _observe_dnn_model(output_dict):
          export_path = tfma.export.export_eval_savedmodel(
              estimator=estimator,
              export_dir_base=export_dir_base,
              eval_input_receiver_fn=eval_input_receiver_fn,
              serving_input_receiver_fn=serving_input_receiver_fn,
              assets_extra=assets_extra,
              checkpoint_path=checkpoint_path,
          )
  
      # Write feature metadata as an asset to model after export has been done.
      # It would be cleaner to write this as an asset during export, but there
      # doesn't seem to be a nice way to do this given how we are monkey-patching
      # to observe/capture the information we need.
      if not export_path:
          raise ValueError(
              "export appears to have failed. export_path was: %s"
              % export_path
          )
  
      export_path = six.ensure_str(export_path)
      output_path = feature_metadata_path(export_path)
      assets_extra_path = os.path.dirname(output_path)
      if not os.path.isdir(assets_extra_path):
          os.mkdir(assets_extra_path)
  
      with open(output_path, "wb+") as f:
          f.write(serialize_feature_metadata(output_dict))
  
      return export_path
  
imports: import contextlib
  import inspect
  import os
  import pickle
  from typing import Any, Callable, Dict, Optional
  import six
  import tensorflow
  from tensorflow import estimator
  import tensorflow_model_analysis
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.utils import util
  from tensorflow.python.feature_column import feature_column_v2
  from tensorflow_estimator.python.estimator.canned import dnn
label_desc: Use image node_id 9 for calling a global function with example usage: export_eval_savedmodel_with_feature_metadata(estimator, export_dir_base, eval_input_receiver_fn, serving_input_receiver_fn, assets_extra, checkpoint_path) and returns: export_path