code: def replace_with_empty_volumes(rng, input, empty_volume_policy):
      """Replaces samples with 0-volumed ones if possible.
  
      Parameters
      ----------
      rng :
          rng
      input : List of np.array
          Batch to process
      empty_volume_policy : str
          one of "left", "right, "middle", "mixed", "all", to indicate if the batch suffix, prefix,
          infix or all of them should be randomly replaced with 0-volumed samples
  
      Returns
      -------
      List of np.array
      """
      if empty_volume_policy is None:
          return input
      if len(input[0].shape) == 0:
          return input
      if empty_volume_policy == "mixed":
          left = replace_with_empty_volumes(rng, input, "left")
          left_and_mid = replace_with_empty_volumes(rng, left, "middle")
          return replace_with_empty_volumes(rng, left_and_mid, "right")
      if empty_volume_policy == "all":
          start = 0
          end = len(input)
      elif empty_volume_policy == "left":
          start = 0
          end = rng.integers(1, len(input) // 3)
      elif empty_volume_policy == "right":
          start = rng.integers(len(input) * 2 // 3, len(input) - 1)
          end = len(input)
      elif empty_volume_policy == "middle":
          start = rng.integers(1 + len(input) // 3, len(input) * 2 // 3)
          end = rng.integers(start + 1, len(input) - 1)
      for i in range(start, end):
          shape = list(input[i].shape)
          shape[0] = 0
          input[i] = np.zeros(dtype=input[i].dtype, shape=shape)
      return input
  
file_path: DALI/dali/test/python/operator_1/test_cast.py
imports: import numpy
  import nvidia.dali.fn
  import nvidia.dali.types
  from nose.tools import nottest
  from nvidia.dali import pipeline_def
  from test_utils import np_type_to_dali
  import itertools
  from nose2.tools import params
label_desc: Use image node_id 3 for calling a global function with example usage: replace_with_empty_volumes(rng, input, empty_volume_policy) and returns: input, input, input, replace_with_empty_volumes