|
|
|
@ -115,8 +115,15 @@ class InplaceTestBase(unittest.TestCase):
|
|
|
|
|
fetch_val2, = exe.run(compiled_prog,
|
|
|
|
|
feed=feed_dict,
|
|
|
|
|
fetch_list=[fetch_var])
|
|
|
|
|
|
|
|
|
|
self.assertTrue(np.array_equal(fetch_val1, fetch_val2))
|
|
|
|
|
#NOTE(zhiqiu): Temporally changed from array_equal to allclose.
|
|
|
|
|
# The real root is fuse_all_reduce and fuse_all_optimizer_opss may
|
|
|
|
|
# result in diff because of the instruction set on the virtual machine.
|
|
|
|
|
# And the related unit tests: test_fuse_all_reduce_pass and test_fuse_optimizer_pass use "almostEqual" in their checks.
|
|
|
|
|
# There are also some related issues:
|
|
|
|
|
# https://github.com/PaddlePaddle/Paddle/issues/21270
|
|
|
|
|
# https://github.com/PaddlePaddle/Paddle/issues/21046
|
|
|
|
|
# https://github.com/PaddlePaddle/Paddle/issues/21045
|
|
|
|
|
self.assertTrue(np.allclose(fetch_val1, fetch_val2))
|
|
|
|
|
|
|
|
|
|
def check_multi_card_fetch_var(self):
|
|
|
|
|
if self.is_invalid_test():
|
|
|
|
@ -160,7 +167,8 @@ class InplaceTestBase(unittest.TestCase):
|
|
|
|
|
fetch_vals.append(fetch_val)
|
|
|
|
|
|
|
|
|
|
for item in fetch_vals:
|
|
|
|
|
self.assertTrue(np.array_equal(fetch_vals[0], item))
|
|
|
|
|
# save above
|
|
|
|
|
self.assertTrue(np.allclose(fetch_vals[0], item))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CUDAInplaceTest(InplaceTestBase):
|
|
|
|
|