diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 43e2733162293dcd90bf4bde5d1a105dd94d45c2..8ed5add5548baa5af02b8d184436ca7d40fbc0ed 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -248,8 +248,9 @@ def _fake_interface_only_(func): raise AssertionError( "'%s' should be called by imperative Varible in imperative mode, please run it in dygraph " "mode. You can turn off paddle.enable_static() if you are in static mode, or turn off " - "ProgramTranslator if you are using @paddle.jit.to_static" % - func.__name__) + "ProgramTranslator if you are using @paddle.jit.to_static. If you have to run ProgramTranslator, " + "please use other API to replace '%s'" % (func.__name__, + func.__name__)) return __impl__ diff --git a/python/paddle/fluid/tests/unittests/test_detach.py b/python/paddle/fluid/tests/unittests/test_detach.py index 9a535f9e00afa1a3c30e9523392948597d2a0f6e..38cdd9b727fc5c61f933372be61cf971f289ef2e 100644 --- a/python/paddle/fluid/tests/unittests/test_detach.py +++ b/python/paddle/fluid/tests/unittests/test_detach.py @@ -162,7 +162,8 @@ class Test_Detach(unittest.TestCase): "in imperative mode, please run it in dygraph mode. You can " "turn off paddle.enable_static() if you are in static mode, " "or turn off ProgramTranslator if you are using " - "@paddle.jit.to_static") + "@paddle.jit.to_static. If you have to run ProgramTranslator, " + "please use other API to replace 'detach'") class TestInplace(unittest.TestCase):