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 6486a4d2365f94f186adbae6550d0e0dfd87de4d..8e75b3c3438c0afb24871838b66e1285da78c592 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