code: def validate_corresponding_slices(
      statistics: statistics_pb2.DatasetFeatureStatisticsList,
      schema: schema_pb2.Schema,
      environment: Optional[Text] = None,
      previous_statistics: Optional[
          statistics_pb2.DatasetFeatureStatisticsList
      ] = None,
      serving_statistics: Optional[
          statistics_pb2.DatasetFeatureStatisticsList
      ] = None,
  ) -> anomalies_pb2.Anomalies:
      """Validates corresponding sliced statistics.
  
      Sliced statistics are flattened into a single unsliced stats input prior to
      validation. If multiple statistics are provided, validation is performed on
      corresponding slices. DatasetConstraints, if present, are applied to the
      overall slice.
  
      Note: This API is experimental and subject to change.
  
      Args:
        statistics: See validate_statistics.
        schema: See validate_statistics.
        environment: See validate_statistics.
        previous_statistics: See validate_statistics.
        serving_statistics: See validate_statistics.
  
      Returns:
        An Anomalies protocol buffer.
  
      Raises:
        TypeError: If any of the input arguments is not of the expected type.
      """
      all_slice_keys = set()
      statistics, keys = _flatten_statistics_for_sliced_validation(
          statistics
      )
      all_slice_keys.update(keys)
      if previous_statistics:
          (
              previous_statistics,
              keys,
          ) = _flatten_statistics_for_sliced_validation(
              previous_statistics
          )
          all_slice_keys.update(keys)
      if serving_statistics:
          (
              serving_statistics,
              keys,
          ) = _flatten_statistics_for_sliced_validation(
              serving_statistics
          )
          all_slice_keys.update(keys)
      schema = _replicate_schema_for_sliced_validation(
          schema, all_slice_keys
      )
      return validate_statistics(
          statistics,
          schema,
          environment,
          previous_statistics,
          serving_statistics,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import logging
  from typing import Callable, Iterable, List, Optional, Text, Tuple, Set
  import apache_beam
  import pyarrow
  import tensorflow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.anomalies.proto import custom_validation_config_pb2
  from tensorflow_data_validation.anomalies.proto import validation_config_pb2
  from tensorflow_data_validation.anomalies.proto import validation_metadata_pb2
  from tensorflow_data_validation.api import validation_options
  from tensorflow_data_validation.pywrap.tensorflow_data_validation_extension import validation
  from tensorflow_data_validation.skew import feature_skew_detector
  from tensorflow_data_validation.skew.protos import feature_skew_results_pb2
  from tensorflow_data_validation.statistics import stats_impl
  from tensorflow_data_validation.statistics import stats_options
  from tensorflow_data_validation.utils import anomalies_util
  from tensorflow_data_validation.utils import slicing_util
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_metadata.proto.v0 import anomalies_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 17 for calling a global function with example usage: validate_corresponding_slices(statistics, schema, environment, previous_statistics, serving_statistics) and returns: validate_statistics