code: def _fixed_size_sample(
      sampled_key: Text,
      size: int,
      name: Text,
      random_seed: Optional[int],
      model_names: Optional[List[Text]] = None,
      output_names: Optional[List[Text]] = None,
      sub_keys: Optional[List[metric_types.SubKey]] = None,
      example_weighted: bool = False,
  ) -> metric_types.MetricComputations:
      """Returns metrics computations for FixedSizeSample metrcs."""
      keys = []
      for model_name in model_names or [""]:
          for output_name in output_names or [""]:
              for sub_key in sub_keys or [None]:
                  keys.append(
                      metric_types.MetricKey(
                          name,
                          model_name=model_name,
                          output_name=output_name,
                          sub_key=sub_key,
                          example_weighted=example_weighted,
                      )
                  )
      return [
          metric_types.MetricComputation(
              keys=keys,
              preprocessors=[
                  metric_types.FeaturePreprocessor(
                      feature_keys=[sampled_key]
                  )
              ],
              combiner=_FixedSizeSampleCombineFn(
                  metric_keys=keys,
                  sampled_key=sampled_key,
                  size=size,
                  example_weighted=example_weighted,
                  random_seed=random_seed,
              ),
          )
      ]
  
file_path: model-analysis/tensorflow_model_analysis/metrics/sample_metrics.py
imports: from typing import Any, List, Optional, Text, Tuple
  import apache_beam
  import numpy
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.utils import beam_util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 1 for calling a global function with example usage: _fixed_size_sample(sampled_key, size, name, random_seed, model_names, output_names, sub_keys, example_weighted) and returns: list