code: def get_clevr_pp(task, outkey="label"):
      """Data preprocess function for clevr dataset."""
  
      def _count_preprocess_fn(data):
          data[outkey] = tf.size(data["objects"]["size"]) - 3
          return data
  
      def _closest_object_preprocess_fn(data):
          dist = tf.reduce_min(data["objects"]["pixel_coords"][:, 2])
          # These thresholds are uniformly spaced and result in more or less balanced
          # distribution of classes.
          thrs = np.array([0.0, 8.0, 8.5, 9.0, 9.5, 10.0, 100.0])
          data[outkey] = tf.reduce_max(tf.where((thrs - dist) < 0))
          return data
  
      task_to_preprocess = {
          "count_all": _count_preprocess_fn,
          "closest_object_distance": _closest_object_preprocess_fn,
      }
  
      return task_to_preprocess[task]
  
imports: import numpy
  from scenic.dataset_lib.big_transfer.registry import Registry
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling a global function with example usage: get_clevr_pp(task, outkey) and returns: task_to_preprocess, data, data