code: def prepare(
      transaction,
      dataset,
      n_worker,
      sizes=(8, 16, 32, 64, 128, 256, 512, 1024),
  ):
      resize_fn = partial(resize_worker, sizes=sizes)
  
      files = sorted(dataset.items, key=lambda x: x[0])
      files = [(i, file) for i, (file, label) in enumerate(files)]
      total = 0
  
      with multiprocessing.Pool(n_worker) as pool:
          for i, imgs in tqdm(pool.imap_unordered(resize_fn, files)):
              for size, img in zip(sizes, imgs):
                  key = f"{size}-{str(i).zfill(5)}".encode("utf-8")
                  transaction.put(key, img)
  
              total += 1
  
          transaction.put(
              "length".encode("utf-8"), str(total).encode("utf-8")
          )
  
file_path: gluon-cv/scripts/gan/stylegan/prepare_data.py
imports: import argparse
  from io import BytesIO
  import multiprocessing
  from functools import partial
  from PIL import Image
  import lmdb
  from tqdm import tqdm
  from mxnet.gluon.data.vision.datasets import ImageFolderDataset
label_desc: Use image node_id 4 for calling a global function with example usage: prepare(transaction, dataset, n_worker, sizes) without return types