code: def map_box(bbox, crop_anchor, crop_shape):
      ndim = int(len(bbox) / 2)
      assert len(crop_anchor) == ndim
      assert len(crop_shape) == ndim
      new_bbox = np.array(bbox)
      for d in range(ndim):
          c_start = crop_anchor[d]
          c_end = crop_anchor[d] + crop_shape[d]
          b_start = bbox[d]
          b_end = bbox[ndim + d]
          rel_extent = c_end - c_start
          n_start = (max(c_start, b_start) - c_start) / rel_extent
          n_end = (min(c_end, b_end) - c_start) / rel_extent
          new_bbox[d] = max(0.0, min(1.0, n_start))
          new_bbox[ndim + d] = max(0.0, min(1.0, n_end))
      return new_bbox
  
imports: from nvidia.dali.pipeline import Pipeline
  from nvidia.dali import pipeline_def
  import nvidia.dali.ops
  import nvidia.dali.fn
  import nvidia.dali.types
  import numpy
  import random
label_desc: Use image node_id 3 for calling a global function with example usage: map_box(bbox, crop_anchor, crop_shape) and returns: new_bbox