                           args=args, kwargs=kwargs, daemon=daemon)
          self.err = None
  
      def run(self):
          try:
              if self._target:
                  self._target(*self._args, **self._kwargs)
          except Exception as err:  # pylint: disable=broad-except
 
</s> remove             #  Shutdown the FixedProducerDispatchers then continue to raise error
            for batcher in self.batchers.values():
                batcher.shutdown_feed()
 </s> add  </s> remove             reached max size => this makes 2 prefetched items! One in the
            queue, one waiting for insertion! """
        for item in self.generator:
            self.queue.put(item)
        self.queue.put(None)
 </s> add             reached max size => this makes prefetch + thread_count prefetched items!
            N in the the queue, one waiting for insertion per thread! """
        try:
            for item in self.generator(*self._gen_args, **self._gen_kwargs):
                self.queue.put(item)
            self.queue.put(None)
        except Exception:
            self.queue.put(None)
            raise </s> remove import numpy as np
 </s> add  </s> remove         self.shutdown_feed = generator.join_subprocess
 </s> add 
    def check_and_raise_error(self):
        """ Checks for errors in thread and raises them in caller """
        if not self.err:
            return
        logger.debug("Thread error caught: %s", self.err)
        raise self.err[1].with_traceback(self.err[2])

                           args=args, kwargs=kwargs, daemon=daemon)
          self.err = None
  
    def check_and_raise_error(self):
        """ Checks for errors in thread and raises them in caller """
        if not self.err:
            return
        logger.debug("Thread error caught: %s", self.err)
        raise self.err[1].with_traceback(self.err[2])

      def run(self):
          try:
              if self._target:
                  self._target(*self._args, **self._kwargs)
          except Exception as err:  # pylint: disable=broad-except
keep keep add keep keep keep keep keep
 de-MultiProcess Training

* Replaced multiprocessing in training_data with threading
* Fix cpu affinity issue
* Using multiple threads for BackgroundGenerator 
lib/multithreading.py