From 9e5129f55ff2470fb9e3173f192c6d0919eb20a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:56:26 +0800 Subject: [PATCH 1/8] Update debugging.py --- python/paddle/amp/debugging.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/amp/debugging.py b/python/paddle/amp/debugging.py index f42045e3f94604..f49c7b18d36d44 100644 --- a/python/paddle/amp/debugging.py +++ b/python/paddle/amp/debugging.py @@ -23,7 +23,7 @@ from paddle.base import core from paddle.base.framework import dygraph_only -from ..framework import LayerHelper, in_dynamic_mode +from ..framework import LayerHelper, in_dynamic_or_pir_mode __all__ = [ "DebugMode", @@ -372,7 +372,7 @@ def check_numerics( stack_height_limit = -1 output_dir = "" - if in_dynamic_mode(): + if in_dynamic_or_pir_mode(): return _C_ops.check_numerics( tensor, op_type, From a2cc730aef75afd907ddbb5f97489e048b99ef0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Thu, 9 Nov 2023 21:11:10 +0800 Subject: [PATCH 2/8] Update test_nan_inf.py --- test/legacy_test/test_nan_inf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/legacy_test/test_nan_inf.py b/test/legacy_test/test_nan_inf.py index e6f6ddb7701440..e8f6091495d33f 100644 --- a/test/legacy_test/test_nan_inf.py +++ b/test/legacy_test/test_nan_inf.py @@ -21,6 +21,7 @@ import numpy as np import paddle +from paddle.pir_utils import test_with_pir_api class TestNanInfBase(unittest.TestCase): @@ -299,6 +300,7 @@ def test_eager(self): debug_mode=paddle.amp.debugging.DebugMode.CHECK_ALL, ) + @test_with_pir_api def test_static(self): paddle.enable_static() shape = [8, 8] From db5335b4b33253145621049e8d7674f7b3cc6ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Fri, 10 Nov 2023 06:56:51 +0800 Subject: [PATCH 3/8] Apply suggestions from code review --- python/paddle/amp/debugging.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/paddle/amp/debugging.py b/python/paddle/amp/debugging.py index f49c7b18d36d44..6718cba2aec58b 100644 --- a/python/paddle/amp/debugging.py +++ b/python/paddle/amp/debugging.py @@ -25,6 +25,7 @@ from ..framework import LayerHelper, in_dynamic_or_pir_mode + __all__ = [ "DebugMode", "TensorCheckerConfig", From d11391742366381f835a5bb6459855efec052ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Fri, 10 Nov 2023 06:57:03 +0800 Subject: [PATCH 4/8] Apply suggestions from code review --- python/paddle/amp/debugging.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/paddle/amp/debugging.py b/python/paddle/amp/debugging.py index 6718cba2aec58b..ce67f1db78eadb 100644 --- a/python/paddle/amp/debugging.py +++ b/python/paddle/amp/debugging.py @@ -24,8 +24,6 @@ from paddle.base.framework import dygraph_only from ..framework import LayerHelper, in_dynamic_or_pir_mode - - __all__ = [ "DebugMode", "TensorCheckerConfig", From 5608dcefa38c75c6ce7b2181c48003181ba71fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Wed, 15 Nov 2023 08:25:55 +0800 Subject: [PATCH 5/8] Update test_nan_inf.py --- test/legacy_test/test_nan_inf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/legacy_test/test_nan_inf.py b/test/legacy_test/test_nan_inf.py index e8f6091495d33f..75b87f1c27df77 100644 --- a/test/legacy_test/test_nan_inf.py +++ b/test/legacy_test/test_nan_inf.py @@ -320,7 +320,7 @@ def test_static(self): ) exe = paddle.static.Executor(paddle.CPUPlace()) exe.run( - main_program, feed={"x": x_np, "y": y_np}, fetch_list=[out.name] + main_program, feed={"x": x_np, "y": y_np}, fetch_list=[out] ) paddle.disable_static() From 5249aa0d0ebf6dca57ac90693321e3622bd8671e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:39:23 +0800 Subject: [PATCH 6/8] Update test_nan_inf.py --- test/legacy_test/test_nan_inf.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/legacy_test/test_nan_inf.py b/test/legacy_test/test_nan_inf.py index 75b87f1c27df77..708407cc84ebfd 100644 --- a/test/legacy_test/test_nan_inf.py +++ b/test/legacy_test/test_nan_inf.py @@ -319,9 +319,7 @@ def test_static(self): debug_mode=paddle.amp.debugging.DebugMode.CHECK_ALL, ) exe = paddle.static.Executor(paddle.CPUPlace()) - exe.run( - main_program, feed={"x": x_np, "y": y_np}, fetch_list=[out] - ) + exe.run(main_program, feed={"x": x_np, "y": y_np}, fetch_list=[out]) paddle.disable_static() From 08fc435c39336a02357497999eb0e2744129c8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:10:48 +0800 Subject: [PATCH 7/8] Update test_nan_inf.py --- test/legacy_test/test_nan_inf.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/legacy_test/test_nan_inf.py b/test/legacy_test/test_nan_inf.py index 708407cc84ebfd..6db010ece73e73 100644 --- a/test/legacy_test/test_nan_inf.py +++ b/test/legacy_test/test_nan_inf.py @@ -21,6 +21,7 @@ import numpy as np import paddle +from paddle.framework import in_pir_mode from paddle.pir_utils import test_with_pir_api @@ -312,12 +313,20 @@ def test_static(self): x = paddle.static.data(name='x', shape=[8, 8], dtype="float32") y = paddle.static.data(name='y', shape=[8, 8], dtype="float32") out = paddle.add(x, y) - paddle.amp.debugging.check_numerics( - tensor=out, - op_type="elementwise_add", - var_name=out.name, - debug_mode=paddle.amp.debugging.DebugMode.CHECK_ALL, - ) + if in_pir_mode(): + paddle.amp.debugging.check_numerics( + tensor=out, + op_type="elementwise_add", + var_name=out.id, + debug_mode=paddle.amp.debugging.DebugMode.CHECK_ALL, + ) + else: + paddle.amp.debugging.check_numerics( + tensor=out, + op_type="elementwise_add", + var_name=out.name, + debug_mode=paddle.amp.debugging.DebugMode.CHECK_ALL, + ) exe = paddle.static.Executor(paddle.CPUPlace()) exe.run(main_program, feed={"x": x_np, "y": y_np}, fetch_list=[out]) paddle.disable_static() From 1c1a199afc24ad641ff8e6ac778b1592822e39fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:38:34 +0800 Subject: [PATCH 8/8] Apply suggestions from code review --- python/paddle/amp/debugging.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/paddle/amp/debugging.py b/python/paddle/amp/debugging.py index ce67f1db78eadb..f49c7b18d36d44 100644 --- a/python/paddle/amp/debugging.py +++ b/python/paddle/amp/debugging.py @@ -24,6 +24,7 @@ from paddle.base.framework import dygraph_only from ..framework import LayerHelper, in_dynamic_or_pir_mode + __all__ = [ "DebugMode", "TensorCheckerConfig",