code: def get_type_specs_from_feature_specs(
      feature_specs: Dict[str, common_types.FeatureSpecType],
      ragged_sequence_features: FrozenSet[str] = frozenset(),
  ) -> Dict[str, tf.TypeSpec]:
      """Returns `tf.TypeSpec`s for the given feature specs.
  
      Returns a dictionary of type_spec with the same type and shape as defined by
      `feature_specs`.
  
      Args:
        feature_specs: A TensorFlow feature spec.
        ragged_sequence_features: Set of names of features representing ragged
          sequence tensors.
  
      Returns:
        A dictionary from strings to `tf.TensorSpec`, `tf.SparseTensorSpec` or
        `tf.RaggedTensorSpec`s.
  
      Raises:
        ValueError: If the feature spec contains feature types not supported.
      """
      result = {}
      for name, feature_spec in feature_specs.items():
          if isinstance(feature_spec, tf.io.FixedLenFeature):
              result[name] = tf.TensorSpec(
                  [None] + list(feature_spec.shape), feature_spec.dtype
              )
          elif isinstance(feature_spec, tf.io.VarLenFeature):
              result[name] = tf.SparseTensorSpec(
                  [None, None], feature_spec.dtype
              )
          elif isinstance(feature_spec, tf.io.SparseFeature):
              shape = [None] + [
                  None if dim == -1 else dim
                  for dim in feature_spec.size
              ]
              result[name] = tf.SparseTensorSpec(
                  shape, feature_spec.dtype
              )
          elif isinstance(feature_spec, tf.io.RaggedFeature):
              # Number of dimensions is number of partitions + 1 + 1 batch dimension.
              shape = [None, None]
              ragged_rank = 1
              # Ragged sequence tensors will have additional sequence dimension.
              if name in ragged_sequence_features:
                  shape.append(None)
                  ragged_rank += 1
              for partition in feature_spec.partitions:
                  if isinstance(
                      partition, tf.io.RaggedFeature.UniformRowLength
                  ):  # pytype: disable=attribute-error
                      shape.append(partition.length)
                  else:
                      shape.append(None)
                      ragged_rank += 1
              result[name] = tf.RaggedTensorSpec(
                  shape=shape,
                  dtype=feature_spec.dtype,
                  ragged_rank=ragged_rank,
                  row_splits_dtype=feature_spec.row_splits_dtype,
              )
          else:
              raise ValueError(
                  "Invalid feature spec {}.".format(feature_spec)
              )
      return result
  
imports: import functools
  import os
  import re
  from typing import Callable, Dict, List, Mapping, Optional, FrozenSet
  from absl import logging
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_transform import analyzer_nodes
  from tensorflow_transform import annotators
  from tensorflow_transform import common_types
  from tensorflow_transform import graph_context
  from tensorflow_transform import graph_tools
  from tensorflow_transform import schema_inference
  from tensorflow_transform import tf2_utils
  from tensorflow_transform import tf_utils
  from tensorflow_transform.output_wrapper import TFTransformOutput
  from tensorflow_transform.saved import saved_transform_io
  from tensorflow_transform.saved import saved_transform_io_v2
  from tensorflow_transform.tf_metadata import dataset_metadata
  from tensorflow_transform.tf_metadata import metadata_io
  from tensorflow_transform.tf_metadata import schema_utils
  from tfx_bsl.coders import example_coder
  from tfx_bsl.tfxio import tensor_to_arrow
  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 9 for calling a global function with example usage: get_type_specs_from_feature_specs(feature_specs, ragged_sequence_features) and returns: result