code: def _create_feature_spec(
      with_label: Optional[bool] = False,
  ) -> Tuple[
      Dict[str, Union[tf.io.FixedLenFeature, tf.io.RaggedFeature]],
      Dict[str, Union[tf.io.FixedLenFeature, tf.io.RaggedFeature]],
  ]:
      """Create context and example feature spec for data parsing.
  
      Args:
          with_label: Includes the label spec if True. Set this to True for
            training.
  
      Returns:
        A pair of dicts for context and example features, mapping each feature key
          to a FixedLenFeature or RaggedFeature.
      """
      context_feature_spec = {
          feature_key: tf.io.RaggedFeature(dtype=tf.string)
          for feature_key in _CONTEXT_RAGGED_FEATURE_KEYS
      }
      example_feature_spec = {
          feature_key: tf.io.RaggedFeature(dtype=tf.string)
          for feature_key in _EXAMPLE_RAGGED_FEATURE_KEYS
      }
      if with_label:
          example_feature_spec[_LABEL_FEATURE] = tf.io.FixedLenFeature(
              shape=(1,),
              dtype=tf.int64,
              default_value=(int(_PADDING_LABEL),),
          )
      return context_feature_spec, example_feature_spec
  
file_path: ranking/tensorflow_ranking/examples/keras/antique_kpl_din.py
imports: import os
  from typing import Dict, Optional, Tuple, Union
  from absl import app
  from absl import flags
  from absl import logging
  import tensorflow
  import tensorflow_ranking
label_desc: Use image node_id 1 for calling a global function with example usage: _create_feature_spec(with_label) and returns: context_feature_spec,  example_feature_spec