def assemble(self, all_res, *args, **kwargs):
""" Assemble the batch after a parallel action """
_ = args, kwargs
if any_action_failed(all_res):
all_errors = self.get_errors(all_res)
print(all_errors)
traceback.print_tb(all_errors[0].__traceback__)
raise RuntimeError("Could not assemble the batch")
components = kwargs.get('components', 'images')
if isinstance(components, (list, tuple)):
all_res = list(zip(*all_res))
else:
components = [components]
all_res = [all_res]
for component, res in zip(components, all_res):
new_data = np.array(res, dtype='object')
setattr(self, component, new_data)
return self
评论列表
文章目录