code: def encode_all_features(dataset, vocabulary):
      """Encode all features.
  
      Args:
        dataset: a tf.data.Dataset
        vocabulary: a vocabulary.Vocabulary
      Returns:
        a tf.data.Dataset
      """
  
      def my_fn(features):
          """Encode all features that are strings and return a dictionary.
  
          Args:
            features: a dictionary
          Returns:
            a dictionary
          """
          ret = {}
          for k, v in features.items():
              if v.dtype == tf.string:
                  v = vocabulary.encode_tf(v)
                  v = tf.concat([tf.cast(v, tf.int64), [1]], 0)
                  ret[k] = v
              else:
                  tf.logging.info(
                      "encode_all_features: skipping non-string feature %s:%s",
                      k,
                      v,
                  )
          return ret
  
      return dataset.map(
          my_fn, num_parallel_calls=tf.data.experimental.AUTOTUNE
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import gin
  import tensorflow.compat.v1
  import tensorflow_datasets
label_desc: Use image node_id 11 for calling a global function with example usage: encode_all_features(dataset, vocabulary) and returns: dataset, ret