code: def _infer_feature_schema_common(
      features: Mapping[str, common_types.TensorType],
      tensor_ranges: Mapping[str, Tuple[int, int]],
      feature_annotations: Mapping[str, List[any_pb2.Any]],
      global_annotations: List[any_pb2.Any],
      sparse_output_annotations: Optional[
          Dict[str, List[Union[int, str]]]
      ],
      is_evaluation_complete: bool,
  ) -> schema_pb2.Schema:
      """Given a dict of tensors, creates a `Schema`.
  
      Args:
        features: A dict mapping column names to `Tensor`, `SparseTensor` or
          `RaggedTensor`. The `Tensor`, `SparseTensor` or `RaggedTensor` should have
          a 0'th dimension which is interpreted as the batch dimension.
        tensor_ranges: A dict mapping a tensor to a tuple containing its min and max
          value.
        feature_annotations: dictionary from feature name to list of any_pb2.Any
          protos to be added as an annotation for that feature in the schema.
        global_annotations: list of any_pb2.Any protos to be added at the global
          schema level.
        sparse_output_annotations: A dict mapping sparse feature names to their
          annotations.
        is_evaluation_complete: A boolean indicating whether all analyzers have been
          evaluated or not.
  
      Returns:
        A `Schema` proto.
      """
      domains = {}
      feature_tags = collections.defaultdict(list)
      for name in features:
          if name in tensor_ranges:
              min_value, max_value = tensor_ranges[name]
              domains[name] = schema_pb2.IntDomain(
                  min=min_value, max=max_value, is_categorical=True
              )
      sparse_output_annotations = sparse_output_annotations or dict()
      feature_spec = _feature_spec_from_batched_tensors(
          features,
          is_evaluation_complete,
          sparse_output_annotations.keys(),
      )
      _override_sparse_feature_annotated_shapes(
          feature_spec, sparse_output_annotations
      )
  
      schema_proto = schema_utils.schema_from_feature_spec(
          feature_spec, domains
      )
  
      # Add the annotations to the schema.
      for annotation in global_annotations:
          schema_proto.annotation.extra_metadata.add().CopyFrom(
              annotation
          )
      # Build a map from logical feature names to Feature protos
      feature_protos_by_name = {}
      for feature in schema_proto.feature:
          feature_protos_by_name[feature.name] = feature
      for sparse_feature in schema_proto.sparse_feature:
          for index_feature in sparse_feature.index_feature:
              feature_protos_by_name.pop(index_feature.name)
          value_feature = feature_protos_by_name.pop(
              sparse_feature.value_feature.name
          )
          feature_protos_by_name[sparse_feature.name] = value_feature
  
      # Handle ragged tensor representations.
      tensor_representations = (
          tensor_representation_util.GetTensorRepresentationsFromSchema(
              schema_proto, schema_utils.TENSOR_REPRESENTATION_GROUP
          )
      )
      if tensor_representations is not None:
          for (
              name,
              tensor_representation,
          ) in tensor_representations.items():
              feature_protos_by_name[
                  name
              ] = schema_utils.pop_ragged_source_columns(
                  name, tensor_representation, feature_protos_by_name
              )
  
      # Update annotations
      for feature_name, annotations in feature_annotations.items():
          feature_proto = feature_protos_by_name[feature_name]
          for annotation in annotations:
              feature_proto.annotation.extra_metadata.add().CopyFrom(
                  annotation
              )
      for feature_name, tags in feature_tags.items():
          feature_proto = feature_protos_by_name[feature_name]
          for tag in tags:
              feature_proto.annotation.tag.append(tag)
      return schema_proto
  
imports: import collections
  import itertools
  from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Tuple, Union
  from absl import logging
  import tensorflow
  from tensorflow_transform import common
  from tensorflow_transform import common_types
  from tensorflow_transform import graph_context
  from tensorflow_transform import tf2_utils
  from tensorflow_transform import tf_utils
  from tensorflow_transform.saved import saved_transform_io_v2
  from tensorflow_transform.tf_metadata import schema_utils
  from tfx_bsl.tfxio import tensor_representation_util
  from google.protobuf import any_pb2
  from tensorflow.python.eager import function
  from tensorflow.python.framework import ops
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 7 for calling a global function with example usage: _infer_feature_schema_common(features, tensor_ranges, feature_annotations, global_annotations, sparse_output_annotations, is_evaluation_complete) and returns: schema_proto