code: def test_tfrecord_odirect():
      batch_size = 16
  
      @pipeline_def(batch_size=batch_size, device_id=0, num_threads=4)
      def tfrecord_pipe(path, index_path, dont_use_mmap, use_o_direct):
          input = fn.readers.tfrecord(
              path=path,
              index_path=index_path,
              dont_use_mmap=dont_use_mmap,
              use_o_direct=use_o_direct,
              features={
                  "image/class/label": tfrec.FixedLenFeature(
                      [1], tfrec.int64, -1
                  )
              },
              name="Reader",
          )
          return input["image/class/label"]
  
      tfrecord = os.path.join(
          get_dali_extra_path(), "db", "tfrecord", "train"
      )
      tfrecord_idx = os.path.join(
          get_dali_extra_path(), "db", "tfrecord", "train.idx"
      )
  
      pipe = tfrecord_pipe(tfrecord, tfrecord_idx, True, True)
      pipe_ref = tfrecord_pipe(tfrecord, tfrecord_idx, False, False)
      pipe.build()
      pipe_ref.build()
      iters = (pipe.epoch_size("Reader") + batch_size) // batch_size
      for _ in range(iters):
          out = pipe.run()
          out_ref = pipe_ref.run()
          for a, b in zip(out, out_ref):
              assert np.array_equal(a.as_array(), b.as_array())
  
imports: from nvidia.dali import Pipeline, pipeline_def
  import nvidia.dali.ops
  import nvidia.dali.fn
  import nvidia.dali.types
  import nvidia.dali.tfrecord
  import os.path
  import tempfile
  import numpy
  from test_utils import compare_pipelines, get_dali_extra_path
  from nose_utils import assert_raises
  from nose2.tools import cartesian_params
  from nose import SkipTest
label_desc: Use image node_id 3 for calling a global function with example usage: test_tfrecord_odirect() and returns: input