Exemple #1
0
 def _start_shuffle_iterator(self):
     if self._shuffle_with_forkpool:
         pool = popen_helper.get_forkpool(3, closing=False)
     else:
         pool = popen_helper.get_threadpool(1, closing=False)
     atexit.register(pool.close)
     args = [(self._elements_in_epoch, stat_utils.random_int32())
             for _ in range(self._maximum_number_epochs)]
     imap = pool.imap if self.deterministic else pool.imap_unordered
     self._shuffle_iterator = imap(stat_utils.permutation, args)
Exemple #2
0
 def _start_shuffle_iterator(self):
   if self._shuffle_with_forkpool:
     pool = popen_helper.get_forkpool(3, closing=False)
   else:
     pool = popen_helper.get_threadpool(1, closing=False)
   atexit.register(pool.close)
   args = [(self._elements_in_epoch, stat_utils.random_int32())
           for _ in range(self._maximum_number_epochs)]
   imap = pool.imap if self.deterministic else pool.imap_unordered
   self._shuffle_iterator = imap(stat_utils.permutation, args)