From 0d1900d3294b4508762b76a702fcdddb9a0d8118 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Fri, 27 Nov 2020 11:14:02 +0800 Subject: [PATCH] add debug msg for test_buffer_shared_memory_reuse_pass (#29151) --- .../test_buffer_shared_memory_reuse_pass.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/tests/unittests/test_buffer_shared_memory_reuse_pass.py b/python/paddle/fluid/tests/unittests/test_buffer_shared_memory_reuse_pass.py index 546124bbee8..eda7c3caaeb 100644 --- a/python/paddle/fluid/tests/unittests/test_buffer_shared_memory_reuse_pass.py +++ b/python/paddle/fluid/tests/unittests/test_buffer_shared_memory_reuse_pass.py @@ -115,7 +115,13 @@ 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)) + self.assertTrue( + np.array_equal(fetch_val1, fetch_val2), + "error var name: {}, fetch_val1: {}, fetch_val2: {}". + format( + fetch_var, + fetch_val1[~np.equal(fetch_val1, fetch_val2)], + fetch_val2[~np.equal(fetch_val1, fetch_val2)])) def check_multi_card_fetch_var(self): if self.is_invalid_test(): @@ -160,6 +166,12 @@ class InplaceTestBase(unittest.TestCase): for item in fetch_vals: self.assertTrue(np.array_equal(fetch_vals[0], item)) + self.assertTrue( + np.array_equal(fetch_vals[0], item), + "error var name: {}, fetch_vals[0]: {}, item: {}". + format(fetch_var, + fetch_vals[0][~np.equal(fetch_vals[0], item)], + item[~np.equal(fetch_vals[0], item)])) class CUDAInplaceTest(InplaceTestBase): -- GitLab