code: def infer_feature_schema_v2(
      features: Mapping[str, common_types.TensorType],
      concrete_metadata_fn: function.ConcreteFunction,
      evaluate_schema_overrides: bool,
  ) -> schema_pb2.Schema:
      """Given a dict of tensors, creates a `Schema`.
  
      Infers a schema, in the format of a tf.Transform `Schema`, for the given
      dictionary of tensors.
  
      If there is an override specified, we override the inferred schema for the
      given feature's tensor.  An override has the meaning that we should set
      is_categorical=True.  If evaluate_schema_overrides is False then we just set
      is_categorical=True, and if evaluate_schema_overrides is True then we also
      compute values of the tensors representing the min and max values and set them
      in the schema.
  
      If annotations have been specified, they are added to the output 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.
        concrete_metadata_fn: A `tf.ConcreteFunction` that returns a dictionary
          containing the deferred annotations added to the graph when invoked with
          any valid input.
        evaluate_schema_overrides: A Boolean used to compute schema overrides. If
          `False`, schema overrides will not be computed.
  
      Returns:
        A `Schema` proto.
      """
      metadata = collections.defaultdict(list, concrete_metadata_fn())
  
      if not evaluate_schema_overrides:
          tensor_ranges = {
              tensor.numpy().decode(): (None, None)
              for tensor in metadata[_TF_METADATA_TENSOR_COLLECTION]
          }
          tensor_annotations = {}
          global_annotations = []
      else:
          tensor_ranges = _get_tensor_ranges_v2(metadata)
          (
              tensor_annotations,
              global_annotations,
          ) = _get_schema_annotations_v2(metadata)
  
      def _get_metadata_sparse_output_annotations(metadata):
          sparse_output_annotations = metadata[
              _METADATA_SPARSE_OUTPUT_OVERRIDES_FIELD
          ]
          if not sparse_output_annotations:
              return None
          return {
              k: [a.numpy() for a in v]
              for k, v in sparse_output_annotations[0].items()
          }
  
      return _infer_feature_schema_common(
          features,
          tensor_ranges,
          tensor_annotations,
          global_annotations,
          sparse_output_annotations=_get_metadata_sparse_output_annotations(
              metadata
          ),
          is_evaluation_complete=evaluate_schema_overrides,
      )
  
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 5 for calling a global function with example usage: infer_feature_schema_v2(features, concrete_metadata_fn, evaluate_schema_overrides) and returns: _infer_feature_schema_common, unknown, None