Skip to content

Instantly share code, notes, and snippets.

@thenomemac
thenomemac / batchgen.py
Last active June 30, 2016 04:43 — forked from ebenolson/batchgen.py
Mini Batch Generation Using Parallel Queue: Lasagne, Neural Networks, python3
# Modified 2016-06-30 by Josiah Olson to add python3 support
# Context manager to generate batches in the background via a process pool
# Usage:
#
# def batch(seed):
# .... # generate minibatch
# return minibatch
#
# with BatchGenCM(batch) as bg:
# minibatch = next(bg)