code: def test_nvjpeg_cached():
      ref_pipe = HybridDecoderPipeline(batch_size, 1, 0, 0)
      ref_pipe.build()
      cached_pipe = HybridDecoderPipeline(batch_size, 1, 0, 100)
      cached_pipe.build()
      epoch_size = ref_pipe.epoch_size("Reader")
  
      for i in range(
          0, (2 * epoch_size + batch_size - 1) // batch_size
      ):
          print(
              "Batch %d-%d / %d"
              % (i * batch_size, (i + 1) * batch_size, epoch_size)
          )
          ref_images, _ = ref_pipe.run()
          out_images, _ = cached_pipe.run()
          compare(ref_images, out_images)
          ref_images, _ = ref_pipe.run()
          out_images, _ = cached_pipe.run()
          compare(ref_images, out_images)
          ref_images, _ = ref_pipe.run()
          out_images, _ = cached_pipe.run()
          compare(ref_images, out_images)
  
file_path: DALI/dali/test/python/test_nvjpeg_cache.py
imports: from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.ops
  import nvidia.dali.types
  from numpy.testing import assert_array_equal
  from test_utils import get_dali_extra_path
label_desc: Use image node_id 2 for calling a global function with example usage: test_nvjpeg_cached() without return types