def _test_pool(self):
def do_test():
p = mp.Pool(2)
for proc in p._pool:
lc.check_pid(proc.pid)
buffers = (torch.zeros(2, 2) for i in range(4))
results = p.map(simple_pool_fill, buffers, 1)
for r in results:
self.assertEqual(r, torch.ones(2, 2) * 5, 0)
self.assertEqual(len(results), 4)
p.close()
p.join()
with leak_checker(self) as lc:
do_test()
评论列表
文章目录