code: def check_sequence_rearrange(
      batch_size,
      shape,
      reorders,
      persample_reorder=True,
      op_type="cpu",
      layout="",
  ):
      pipe = Pipeline(batch_size=batch_size, num_threads=4, device_id=0)
      with pipe:
          input = fn.external_source(
              lambda: get_sequences(batch_size, shape), layout=layout
          )
          frames = input.gpu() if op_type == "gpu" else input
          order = (
              fn.external_source(lambda: reorders)
              if persample_reorder
              else reorders
          )
          rearranged = fn.sequence_rearrange(
              frames, new_order=order, device=op_type
          )
          pipe.set_outputs(rearranged, input)
      pipe.build()
      result, input = pipe.run()
      if op_type == "gpu":
          result = result.as_cpu()
      input = to_batch(input, batch_size)
      baseline = reorder(input, shape[0], reorders, persample_reorder)
      for i in range(batch_size):
          np.testing.assert_array_equal(result[i], baseline[i])
  
file_path: DALI/dali/test/python/operator_2/test_sequence_rearrange.py
imports: from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.fn
  import numpy
  from nose_utils import raises
label_desc: Use image node_id 6 for calling a global function with example usage: check_sequence_rearrange(batch_size, shape, reorders, persample_reorder, op_type, layout) without return types