code: def test_sliced_data_iterator_duplicated_unexpectedly(
      test_data_csv_png_10,
      num_of_slices,
      size,
      batch_size,
      shuffle,
      drop_last,
  ):
      # As the discussion in this: https://app.slack.com/client/TAVSDRN92/CCWT3ENA2/thread/CCWT3ENA2-1653356233.062649
      # Each slice might have overlapped items after the random order of each epoch is updated.
      # It only assumes that each slice at each epoch have different dataset.
      def test_load_func(position):
          return np.full((1), position, dtype=np.int32)
  
      di = data_iterator_simple(
          test_load_func, size, batch_size, shuffle=shuffle
      )
  
      def lcm(a, b):
          return abs(a * b) / math.gcd(a, b) if a and b else 0
  
      max_epoch = int(lcm(batch_size, size) / size)
  
      epoch = []
      data_per_epoch = []
  
      slice_di_list = []
      for slice_pos in range(num_of_slices):
          sliced_di = di.slice(
              rng=None,
              num_of_slices=num_of_slices,
              slice_pos=slice_pos,
              drop_last=drop_last,
          )
          slice_di_list.append(sliced_di)
  
      offset = 0
      for _ in range(max_epoch):
          data_per_batch = []
          for sliced_di in slice_di_list:
              batch = sliced_di.next()
              data_per_batch.append([d for dat in batch for d in dat])
              data_per_epoch.append(data_per_batch[-1][:])
          for i in range(len(data_per_batch) - 1):
              for j in range(i + 1, len(data_per_batch)):
                  ok = (
                      len(
                          set(data_per_batch[i])
                          & set(data_per_batch[j])
                      )
                      == 0
                  )
                  if not ok:
                      print("=" * 50)
                      for x in range(len(data_per_batch)):
                          print(
                              f"{len(epoch)}: {i} <--> {j}: {sorted(data_per_batch[x])}"
                          )
                      print(
                          f"{set(data_per_batch[i]) & set(data_per_batch[j])}"
                      )
                      print("=" * 50)
                  assert ok, "data overlapped in same epoch!"
          if offset + batch_size >= size:
              epoch.append(data_per_epoch)
              data_per_epoch = []
              offset += batch_size
              offset -= size
          else:
              offset += batch_size
  
      if shuffle:
          for i in range(len(epoch) - 1):
              for j in range(i + 1, len(epoch)):
                  for k in range(len(epoch[i])):
                      ok = set(epoch[i][k]) != set(epoch[j][k])
                      if not ok:
                          print("-" * 50)
                          print(f"{k}: {i} {sorted(epoch[i][k])}")
                          print(f"{k}: {j} {sorted(epoch[j][k])}")
                          print("-" * 50)
                      assert (
                          ok
                      ), "Not allow duplicated data set occurs in shuffle mode."
  
      for sliced_di in slice_di_list:
          sliced_di.close()
      di.close()
  
file_path: nnabla/python/test/utils/test_sliced_data_iterator.py
imports: import pytest
  import numpy
  import math
  from functools import partial
  from nnabla.utils.data_source_loader import load_image
  from nnabla.utils.data_iterator import data_iterator_simple
  from .test_data_iterator import check_data_iterator_result
  from .conftest import generate_cache_dir
label_desc: Use image node_id 2 for calling a global function with example usage: test_sliced_data_iterator_duplicated_unexpectedly(test_data_csv_png_10, num_of_slices, size, batch_size, shuffle, drop_last) and returns: np, unknown