code: def _batched_placeholder_from_feature_spec(name, feature_spec):
      """Creates a batched placeholder from a feature spec."""
      scope_name = _sanitize_scope_name(name)
      if isinstance(feature_spec, tf.io.FixedLenFeature):
          return tf.compat.v1.placeholder(
              feature_spec.dtype,
              [None] + feature_spec.shape,
              name=scope_name,
          )
      elif isinstance(feature_spec, tf.io.VarLenFeature):
          return tf.compat.v1.sparse_placeholder(
              feature_spec.dtype, [None, None], name=scope_name
          )
      elif isinstance(feature_spec, tf.io.SparseFeature):
          shape = (
              [None] + feature_spec.size
              if isinstance(feature_spec.size, list)
              else [None, feature_spec.size]
          )
          return tf.compat.v1.sparse_placeholder(
              feature_spec.dtype, shape, name=scope_name
          )
  
      raise ValueError(
          "Unsupported feature spec: {}({}) for feature {}".format(
              feature_spec, type(feature_spec), name
          )
      )
  
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 5 for calling a global function with example usage: _batched_placeholder_from_feature_spec(name, feature_spec) and returns: tf, tf, tf