code: def get_simple_fixed_prediction_estimator_and_metadata(
      output_prediction_key=prediction_keys.PredictionKeys.PREDICTIONS,
  ):
      """Returns a simple fixed prediction estimator and metadata.
  
      Exposed for use with ExporterTest.
  
      Args:
        output_prediction_key: Output prediction key.
  
      Returns:
        Dictionary containing estimator, eval_input_receiver_fn,
        serving_input_receiver_fn, train_input_fn and model_fn.
      """
  
      def model_fn(features, labels, mode, config):
          """Model function for custom estimator."""
          del config
          predictions = features["prediction"]
  
          if output_prediction_key is not None:
              predictions_dict = {
                  output_prediction_key: predictions,
              }
          else:
              # For simulating Estimators which don't return a predictions dict in
              # EVAL mode.
              predictions_dict = {}
  
          if mode == tf_estimator.ModeKeys.PREDICT:
              return tf_estimator.EstimatorSpec(
                  mode=mode,
                  predictions=predictions_dict,
                  export_outputs={
                      tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY: tf_estimator.export.RegressionOutput(
                          predictions
                      )
                  },
              )
  
          loss = tf.compat.v1.losses.mean_squared_error(
              predictions, labels
          )
          train_op = tf.compat.v1.assign_add(
              tf.compat.v1.train.get_global_step(), 1
          )
          eval_metric_ops = {
              metric_keys.MetricKeys.LOSS_MEAN: tf.compat.v1.metrics.mean(
                  loss
              ),
          }
  
          return tf_estimator.EstimatorSpec(
              mode=mode,
              loss=loss,
              train_op=train_op,
              predictions=predictions_dict,
              eval_metric_ops=eval_metric_ops,
          )
  
      def train_input_fn():
          """Train input function."""
          return (
              {
                  "prediction": tf.constant(
                      [[1.0], [2.0], [3.0], [4.0]]
                  ),
              },
              tf.constant([[1.0], [2.0], [3.0], [4.0]]),
          )
  
      estimator = tf_estimator.Estimator(model_fn=model_fn)
  
      feature_spec = {
          "prediction": tf.io.FixedLenFeature([1], dtype=tf.float32)
      }
      eval_feature_spec = {
          "prediction": tf.io.FixedLenFeature([1], dtype=tf.float32),
          "label": tf.io.FixedLenFeature([1], dtype=tf.float32),
      }
  
      return {
          "estimator": estimator,
          "serving_input_receiver_fn": (
              tf_estimator.export.build_parsing_serving_input_receiver_fn(
                  feature_spec
              )
          ),
          "eval_input_receiver_fn": export.build_parsing_eval_input_receiver_fn(
              eval_feature_spec, label_key="label"
          ),
          "train_input_fn": train_input_fn,
          "model_fn": model_fn,
      }
  
imports: import tensorflow
  from tensorflow import estimator
  from tensorflow_model_analysis.eval_saved_model import export
  from tensorflow_model_analysis.eval_saved_model.example_trainers import util
  from tensorflow.python.estimator.canned import metric_keys
  from tensorflow.python.estimator.canned import prediction_keys
label_desc: Use image node_id 1 for calling a global function with example usage: get_simple_fixed_prediction_estimator_and_metadata(output_prediction_key) and returns: dict, tf_estimator, dict,  tf, tf_estimator