def worker_loop_v1(dataset, key_queue, data_queue, batchify_fn):
    """Worker loop for multiprocessing DataLoader."""
    while True:
        idx, samples = key_queue.get()
        if idx is None:
            break
        batch = batchify_fn([dataset[i] for i in samples])
        data_queue.put((idx, batch))
def worker_loop_v1 ( dataset , key_queue , data_queue , batchify_fn ) : while True : idx , samples = key_queue . get ( ) if idx is None : break batch = batchify_fn ( [ dataset [ i ] for i in samples ] ) data_queue . put ( ( idx , batch ) )
Worker loop for multiprocessing DataLoader.