code: def check_operator_coco_reader_custom_order(
      order=None, add_invalid_paths=False
  ):
      batch_size = 2
      if not order:
          order = range(len(test_data))
      keys = list(test_data.keys())
      values = list(s.id for s in test_data.values())
      images = [keys[i] for i in order]
      images_arg = images.copy()
      if add_invalid_paths:
          images_arg += ["/invalid/path/image.png"]
      expected_ids = [values[i] for i in order]
      with tempfile.TemporaryDirectory() as annotations_dir:
          pipeline = Pipeline(
              batch_size=batch_size, num_threads=4, device_id=0
          )
          with pipeline:
              _, _, _, ids = fn.readers.coco(
                  file_root=file_root,
                  annotations_file=train_annotations,
                  image_ids=True,
                  images=images_arg,
                  save_preprocessed_annotations=True,
                  save_preprocessed_annotations_dir=annotations_dir,
              )
              pipeline.set_outputs(ids)
          pipeline.build()
  
          i = 0
          assert len(images) % batch_size == 0
          while i < len(images):
              out = pipeline.run()
              for s in range(batch_size):
                  assert (
                      out[0].at(s) == expected_ids[i]
                  ), f"{i}, {expected_ids}"
                  i = i + 1
  
          filenames_file = os.path.join(
              annotations_dir, "filenames.dat"
          )
          with open(filenames_file) as f:
              lines = f.read().splitlines()
          assert lines.sort() == images.sort()
  
imports: import numpy
  import nvidia.dali.fn
  import os
  import tempfile
  import json
  from nvidia.dali import Pipeline, pipeline_def
  from nose_utils import raises
  from nose2.tools import params
  from test_utils import compare_pipelines, get_dali_extra_path
label_desc: Use image node_id 1 for calling a global function with example usage: check_operator_coco_reader_custom_order(order, add_invalid_paths) without return types