From 3862f347c41b79b24c499a02f8ee838c1b4c09a9 Mon Sep 17 00:00:00 2001 From: xiongkun Date: Thu, 9 Feb 2023 16:36:44 +0800 Subject: [PATCH] consider grad_op exist in forward program. (#50321) --- python/paddle/jit/dy2static/origin_info.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/paddle/jit/dy2static/origin_info.py b/python/paddle/jit/dy2static/origin_info.py index 40afab7459..8d6b01a04e 100644 --- a/python/paddle/jit/dy2static/origin_info.py +++ b/python/paddle/jit/dy2static/origin_info.py @@ -329,6 +329,11 @@ def update_op_callstack_with_origin_info(program): callstack = get_new_op_callstack(callstack) - op._set_attr(callstack_var_name, callstack) + try: + # (@xiongkun) In 2-order derivative for paddle science, there may exists `pow_grad` + # which has op_proto == nullptr and causes _set_attr failed. so we add a try...except. + op._set_attr(callstack_var_name, callstack) + except: + pass return program -- GitLab