                       "is_timelapse: %s)", len(images), batchsize, side, do_shuffle, is_timelapse)
          self.batchsize = batchsize
          q_name = "timelapse_{}".format(side) if is_timelapse else "train_{}".format(side)
          load_thread = FixedProducerDispatcher(
              self.load_batches,
              batch_shape,
              args=(images, q_name, side, is_timelapse, do_shuffle, batchsize),
 
</s> remove         q_size = batchsize * 8
        # Don't use a multiprocessing queue because sometimes the MP Manager borks on numpy arrays
        queue_manager.add_queue(q_name, maxsize=q_size, multiprocessing_queue=False)
        load_thread = MultiThread(self.load_batches,
                                  images,
                                  q_name,
                                  side,
                                  is_timelapse,
                                  do_shuffle)
 </s> add         load_thread = FixedProducerDispatcher(
            self.load_batches,
            batch_shape,
            args=(images, q_name, side, is_timelapse, do_shuffle, batchsize),
            log_queue=queue_manager._log_queue,
            log_level=logger.getEffectiveLevel(),
        ) </s> remove         while True:
            if do_shuffle:
                shuffle(images)
            for img in images:
                logger.trace("Putting to batch queue: (q_name: '%s', side: '%s')", q_name, side)
                queue.put(self.process_face(img, side, is_timelapse))
            epoch += 1
 </s> add         def _img_iter(imgs):
            while True:
                if do_shuffle:
                    shuffle(imgs)
                for img in imgs:
                    yield img
        img_iter = _img_iter(images)
        epoch = 0
        for memory_wrapper in mem_gen:
            memory = memory_wrapper.get()
            logger.debug("Putting to batch queue: (q_name: '%s', side: '%s')", q_name, side)
            for i, img_path in enumerate(img_iter):
                imgs = self.process_face(img_path, side, is_timelapse)
                for j, img in enumerate(imgs):
                    memory[j][i][:] = img
                epoch += 1
                if i == batchsize - 1:
                    break
            memory_wrapper.ready() </s> remove         epoch = 0
        queue = queue_manager.get_queue(q_name)
 </s> add  </s> remove     def load_batches(self, images, q_name, side, is_timelapse, do_shuffle=True):
 </s> add     def load_batches(self, mem_gen, images, q_name, side, is_timelapse, do_shuffle=True, batchsize=0):
        batch_shape = list((
            (batchsize,256,256,3), # sample images. We assume (256,256,3) for now
            (batchsize, self.model_input_size, self.model_input_size, 3),
            (batchsize, self.model_output_size, self.model_output_size, 3),
        ))
        if self.mask_function:
            batch_shape.append((self.batchsize, self.model_input_size, self.model_input_size, 1))

                       "is_timelapse: %s)", len(images), batchsize, side, do_shuffle, is_timelapse)
          self.batchsize = batchsize
        batch_shape = list((
            (batchsize,256,256,3), # sample images. We assume (256,256,3) for now
            (batchsize, self.model_input_size, self.model_input_size, 3),
            (batchsize, self.model_output_size, self.model_output_size, 3),
        ))
        if self.mask_function:
            batch_shape.append((self.batchsize, self.model_input_size, self.model_input_size, 1))

          q_name = "timelapse_{}".format(side) if is_timelapse else "train_{}".format(side)
          load_thread = FixedProducerDispatcher(
              self.load_batches,
              batch_shape,
              args=(images, q_name, side, is_timelapse, do_shuffle, batchsize),
keep add keep keep keep keep keep
 Added multithreading dispatcher for training_data 
lib/training_data.py