code: def batch_map_fn(map_fn, inputs, *args):
      """Apply map_fn at batch dimension."""
      if isinstance(inputs[0], (list, tuple)):
          batch_size = len(inputs[0])
      else:
          batch_size = inputs[0].shape.as_list()[0]
  
      if not batch_size:
          # handle dynamic batch size: tf.vectorized_map is faster than tf.map_fn.
          return tf.vectorized_map(map_fn, inputs, *args)
  
      outputs = []
      for i in range(batch_size):
          outputs.append(map_fn([x[i] for x in inputs]))
      return [tf.stack(y) for y in zip(*outputs)]
  
file_path: DALI/docs/examples/use_cases/tensorflow/efficientdet/model/utils/postprocess.py
imports: from typing import List, Tuple
  from absl import logging
  import tensorflow
  from pipeline import anchors
label_desc: Use image node_id 2 for calling a global function with example usage: batch_map_fn(map_fn, inputs) and returns: unknown, tf