def share(self):
shared = super().share()
if hasattr(self, 'lastYs'):
# share lastYs to communicate between batch_act and observe
shared['lastYs'] = self.lastYs
if self.opt.get('numthreads', 1) > 1:
if type(self.index) is not multiprocessing.sharedctypes.Synchronized:
# for multithreading need to move index into threadsafe memory
self.index = Value('l', -1)
if hasattr(self, 'sorted_data'):
shared['sorted_data'] = self.sorted_data
shared['batches'] = self.batches
else:
shared['data_loader'] = self.data_loader
shared['index'] = self.index
return shared
评论列表
文章目录