code: def iterate(bs=32, val=True, shuffle=True):
      cir = get_imagenet_categories()
      files = get_val_files() if val else get_train_files()
      order = list(range(0, len(files)))
      if DEBUG >= 1:
          print(f"imagenet size {len(order)}")
      if shuffle:
          random.shuffle(order)
      from multiprocessing import Pool
  
      p = Pool(16)
      for i in range(0, len(files), bs):
          X = p.map(image_load, [files[i] for i in order[i : i + bs]])
          Y = [cir[files[i].split("/")[-2]] for i in order[i : i + bs]]
          yield (np.array(X), np.array(Y))
  
file_path: tinygrad/extra/datasets/imagenet.py
imports: import glob, random, json
  import numpy
  from PIL import Image
  import functools, pathlib
  from tinygrad.helpers import DEBUG, diskcache
label_desc: Use image node_id 5 for calling a global function with example usage: iterate(bs, val, shuffle) without return types