code: def input_tfrecord(
      tfrecord_files,
      tfrecord_idxs,
      device,
      shard_id,
      num_shards,
      random_shuffle=True,
  ):
      inputs = dali.fn.readers.tfrecord(
          path=tfrecord_files,
          index_path=tfrecord_idxs,
          features={
              "image/encoded": dali.tfrecord.FixedLenFeature(
                  (), dali.tfrecord.string, ""
              ),
              "image/height": dali.tfrecord.FixedLenFeature(
                  (), dali.tfrecord.int64, -1
              ),
              "image/width": dali.tfrecord.FixedLenFeature(
                  (), dali.tfrecord.int64, -1
              ),
              "image/object/bbox/xmin": dali.tfrecord.VarLenFeature(
                  dali.tfrecord.float32, 0.0
              ),
              "image/object/bbox/xmax": dali.tfrecord.VarLenFeature(
                  dali.tfrecord.float32, 0.0
              ),
              "image/object/bbox/ymin": dali.tfrecord.VarLenFeature(
                  dali.tfrecord.float32, 0.0
              ),
              "image/object/bbox/ymax": dali.tfrecord.VarLenFeature(
                  dali.tfrecord.float32, 0.0
              ),
              "image/object/class/label": dali.tfrecord.VarLenFeature(
                  dali.tfrecord.int64, 0
              ),
          },
          shard_id=shard_id,
          num_shards=num_shards,
          random_shuffle=random_shuffle,
      )
  
      images = dali.fn.decoders.image(
          inputs["image/encoded"],
          device="mixed" if device == "gpu" else "cpu",
          output_type=dali.types.RGB,
      )
      xmin = inputs["image/object/bbox/xmin"]
      xmax = inputs["image/object/bbox/xmax"]
      ymin = inputs["image/object/bbox/ymin"]
      ymax = inputs["image/object/bbox/ymax"]
      bboxes = dali.fn.transpose(
          dali.fn.stack(xmin, ymin, xmax, ymax), perm=[1, 0]
      )
      classes = dali.fn.cast(
          inputs["image/object/class/label"], dtype=dali.types.INT32
      )
      return (
          images,
          bboxes,
          classes,
          dali.fn.cast(inputs["image/width"], dtype=dali.types.FLOAT),
          dali.fn.cast(inputs["image/height"], dtype=dali.types.FLOAT),
      )
  
imports: import math
  import nvidia.dali
label_desc: Use image node_id 1 for calling a global function with example usage: input_tfrecord(tfrecord_files, tfrecord_idxs, device, shard_id, num_shards, random_shuffle) and returns: images,  bboxes,  classes,  dali,  dali