code: def metric_computations_using_keras_saved_model(
      model_name: str,
      model_loader: types.ModelLoader,
      eval_config: Optional[config_pb2.EvalConfig],
      batch_size: Optional[int] = None,
  ) -> metric_types.MetricComputations:
      """Returns computations for computing metrics natively using keras.
  
      Args:
        model_name: Name of model.
        model_loader: Loader for shared model containing keras saved model to use
          for metric computations.
        eval_config: Eval config.
        batch_size: Batch size to use during evaluation (testing only).
      """
      model = model_loader.load()
      # If metrics were only added using model.compile then use
      # model.compiled_metrics and model.compiled_loss to compute the metrics,
      # otherwise custom metrics added via model.add_metric were also used and we
      # need to call model.evaluate.
      if not model.metrics:
          return []
      elif (
          hasattr(model, "compiled_metrics")
          and model.compiled_metrics
          and hasattr(model, "compiled_loss")
          and model.compiled_loss
          and len(model.compiled_metrics.metrics)
          + len(model.compiled_loss.metrics)
          == len(model.metrics)
      ):
          if hasattr(model, "output_names") and model.output_names:
              output_names = model.output_names
          else:
              output_names = []
          keys = _metric_keys(
              chain(
                  model.compiled_metrics.metrics,
                  model.compiled_loss.metrics,
              ),
              model_name,
              output_names,
          )
          return [
              metric_types.MetricComputation(
                  keys=keys,
                  preprocessors=None,
                  combiner=_KerasCompiledMetricsCombiner(
                      keys,
                      model_name,
                      model_loader,
                      eval_config,
                      batch_size,
                  ),
              )
          ]
      else:
          if hasattr(model, "output_names") and model.output_names:
              output_names = model.output_names
          else:
              output_names = []
          keys = _metric_keys(model.metrics, model_name, output_names)
          specs = model_util.get_input_specs(model, signature_name=None)
          feature_keys = list(specs) if specs else []
          return [
              metric_types.MetricComputation(
                  keys=keys,
                  preprocessors=[
                      metric_types.StandardMetricInputsPreprocessorList(
                          [
                              metric_types.FeaturePreprocessor(
                                  feature_keys=feature_keys,
                                  model_names=[model_name],
                              ),
                              metric_types.TransformedFeaturePreprocessor(
                                  feature_keys=feature_keys,
                                  model_names=[model_name],
                              ),
                          ]
                      )
                  ],
                  combiner=_KerasEvaluateCombiner(
                      keys,
                      model_name,
                      model_loader,
                      eval_config,
                      batch_size,
                  ),
              )
          ]
  
imports: import collections
  from itertools import chain
  from typing import Dict, Iterable, List, Optional
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import tf_metric_accumulators
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 1 for calling a global function with example usage: metric_computations_using_keras_saved_model(model_name, model_loader, eval_config, batch_size) and returns: list, list, list