From 45702951226401a24df501960d7fd9b47152083d Mon Sep 17 00:00:00 2001 From: WangXi Date: Sun, 15 Dec 2019 16:39:19 +0800 Subject: [PATCH] fix assert in nan inf tests, test=develop (#21742) --- python/paddle/fluid/tests/unittests/check_nan_inf_base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/tests/unittests/check_nan_inf_base.py b/python/paddle/fluid/tests/unittests/check_nan_inf_base.py index 6486a4d2365..8e75b3c3438 100644 --- a/python/paddle/fluid/tests/unittests/check_nan_inf_base.py +++ b/python/paddle/fluid/tests/unittests/check_nan_inf_base.py @@ -107,10 +107,14 @@ if __name__ == '__main__': assert False except Exception as e: print(e) - assert type(e) == core.EnforceNotMet + print(type(e)) + # Note. Enforce in cuda kernel may not catch in paddle, and + # Exception type will be RuntimeError + assert type(e) == core.EnforceNotMet or type(e) == RuntimeError try: check(use_cuda=False) assert False except Exception as e: print(e) + print(type(e)) assert type(e) == core.EnforceNotMet -- GitLab