未验证 提交 da9e9dd0 编写于 作者: Z Zeng Jinle 提交者: GitHub

fix py_reader combination ut, test=develop (#20861)

上级 84d221b6
...@@ -43,6 +43,12 @@ class TestPyReaderCombination(unittest.TestCase): ...@@ -43,6 +43,12 @@ class TestPyReaderCombination(unittest.TestCase):
self.assertTrue(np.array_equal(image1, image2)) self.assertTrue(np.array_equal(image1, image2))
self.assertTrue(np.array_equal(label1, label2)) self.assertTrue(np.array_equal(label1, label2))
# FIXME(zjl): do not know why Python 35 would raise SIGABRT if not reset reader
# manually.
def _reset_iterable_reader(self, py_reader):
if py_reader.iterable:
py_reader._loader._reset()
def main_impl(self, place): def main_impl(self, place):
with fluid.program_guard(fluid.Program(), fluid.Program()): with fluid.program_guard(fluid.Program(), fluid.Program()):
image = fluid.layers.data( image = fluid.layers.data(
...@@ -70,6 +76,9 @@ class TestPyReaderCombination(unittest.TestCase): ...@@ -70,6 +76,9 @@ class TestPyReaderCombination(unittest.TestCase):
self.assertEqual(batch_num, max_num) self.assertEqual(batch_num, max_num)
self._reset_iterable_reader(py_reader1)
self._reset_iterable_reader(py_reader2)
def get_places(self): def get_places(self):
if fluid.is_compiled_with_cuda(): if fluid.is_compiled_with_cuda():
return [fluid.CUDAPlace(0), fluid.CPUPlace()] return [fluid.CUDAPlace(0), fluid.CPUPlace()]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册