Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
328195d7
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
328195d7
编写于
4月 23, 2023
作者:
N
niuliling123
提交者:
GitHub
4月 23, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete temp param in eager_gen (#53047)
* Delete temp param in eager_gen
上级
b02687cc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
5 addition
and
16 deletion
+5
-16
paddle/fluid/eager/api/manual/eager_manual/forwards/add_n_fwd_func.cc
.../eager/api/manual/eager_manual/forwards/add_n_fwd_func.cc
+1
-3
paddle/fluid/eager/api/manual/eager_manual/forwards/conv2d_fwd_function.cc
...r/api/manual/eager_manual/forwards/conv2d_fwd_function.cc
+1
-3
paddle/fluid/eager/api/manual/eager_manual/forwards/sync_batch_norm_fwd_func.cc
.../manual/eager_manual/forwards/sync_batch_norm_fwd_func.cc
+1
-3
paddle/fluid/eager/auto_code_generator/generator/eager_gen.py
...le/fluid/eager/auto_code_generator/generator/eager_gen.py
+1
-7
paddle/fluid/pybind/eager_utils.cc
paddle/fluid/pybind/eager_utils.cc
+1
-0
未找到文件。
paddle/fluid/eager/api/manual/eager_manual/forwards/add_n_fwd_func.cc
浏览文件 @
328195d7
...
...
@@ -56,11 +56,9 @@ paddle::Tensor add_n_ad_func(const std::vector<paddle::Tensor>& x) {
<<
"add_n_ad_func"
;
auto
api_result
=
paddle
::
experimental
::
add_n
(
x
);
std
::
string
forward_trace
=
""
;
// Check NaN and Inf if needed
if
(
FLAGS_check_nan_inf
)
{
egr
::
CheckTensorHasNanOrInf
(
"add_n"
,
api_result
);
forward_trace
=
egr
::
Controller
::
Instance
().
GetPythonStack
();
}
// Get Outputs
...
...
@@ -89,7 +87,7 @@ paddle::Tensor add_n_ad_func(const std::vector<paddle::Tensor>& x) {
// Set forward's stack
if
(
FLAGS_check_nan_inf
)
{
grad_node
->
SetForwardTrace
(
forward_trace
);
grad_node
->
SetForwardTrace
(
egr
::
Controller
::
Instance
().
GetPythonStack
()
);
}
// SetAttributes if needed
...
...
paddle/fluid/eager/api/manual/eager_manual/forwards/conv2d_fwd_function.cc
浏览文件 @
328195d7
...
...
@@ -110,11 +110,9 @@ paddle::Tensor conv2d_ad_func(const paddle::Tensor& input,
dilations
,
groups
,
data_format
);
std
::
string
forward_trace
=
""
;
// Check NaN and Inf if needed
if
(
FLAGS_check_nan_inf
)
{
egr
::
CheckTensorHasNanOrInf
(
"conv2d"
,
api_result
);
forward_trace
=
egr
::
Controller
::
Instance
().
GetPythonStack
();
}
// Get Outputs
...
...
@@ -143,7 +141,7 @@ paddle::Tensor conv2d_ad_func(const paddle::Tensor& input,
// Set forward's stack
if
(
FLAGS_check_nan_inf
)
{
grad_node
->
SetForwardTrace
(
forward_trace
);
grad_node
->
SetForwardTrace
(
egr
::
Controller
::
Instance
().
GetPythonStack
()
);
}
// SetAttributes if needed
...
...
paddle/fluid/eager/api/manual/eager_manual/forwards/sync_batch_norm_fwd_func.cc
浏览文件 @
328195d7
...
...
@@ -172,11 +172,9 @@ sync_batch_norm__ad_func(const paddle::Tensor& x,
data_layout
,
use_global_stats
,
trainable_statistics
);
std
::
string
forward_trace
=
""
;
// Check NaN and Inf if needed
if
(
FLAGS_check_nan_inf
)
{
egr
::
CheckTensorHasNanOrInf
(
"sync_batch_norm_"
,
api_result
);
forward_trace
=
egr
::
Controller
::
Instance
().
GetPythonStack
();
}
// Get Outputs
...
...
@@ -231,7 +229,7 @@ sync_batch_norm__ad_func(const paddle::Tensor& x,
// Set forward's stack
if
(
FLAGS_check_nan_inf
)
{
grad_node
->
SetForwardTrace
(
forward_trace
);
grad_node
->
SetForwardTrace
(
egr
::
Controller
::
Instance
().
GetPythonStack
()
);
}
egr
::
Controller
::
Instance
().
PushBackForceSequentialNodes
(
grad_node
.
get
());
...
...
paddle/fluid/eager/auto_code_generator/generator/eager_gen.py
浏览文件 @
328195d7
...
...
@@ -299,7 +299,7 @@ FORWARD_BODY_TEMPLATE = """ if(require_any_grad) {{
{}
// Set for forward trace
if (FLAGS_check_nan_inf) {{
{}
grad_node->SetForwardTrace(egr::Controller::Instance().GetPythonStack());
}}
// SetAttributes if needed
{}
...
...
@@ -490,10 +490,8 @@ CHECK_BACKWARD_INPLACE_TEMPLATE = """
}}"""
CHECK_NAN_AND_INF_TEMPLATE_FORWARD
=
"""
std::string forward_trace ="";
if (FLAGS_check_nan_inf) {{
egr::CheckTensorHasNanOrInf("{}", {});
forward_trace = egr::Controller::Instance().GetPythonStack();
}}
"""
...
...
@@ -1070,15 +1068,11 @@ class DygraphFunctionGeneratorBase(FunctionGeneratorBase):
node_event_name
=
forward_api_name
+
" node_creation"
node_creation_event_str
=
f
"
{
indent
}
paddle::platform::RecordEvent node_creation_record_event(
\"
{
node_event_name
}
\"
, paddle::platform::TracerEventType::OperatorInner, 1);
\n
"
set_forward_trace
=
(
f
"
{
indent
}
grad_node->SetForwardTrace(forward_trace);"
)
if
not
for_backward
:
self
.
node_creation_str
=
FORWARD_BODY_TEMPLATE
.
format
(
node_creation_event_str
,
pass_stop_gradient_args_str
,
node_construction_str
,
set_forward_trace
,
set_attributes_str
,
set_input_tensor_wrappers_str
,
set_grad_out_meta_str
,
...
...
paddle/fluid/pybind/eager_utils.cc
浏览文件 @
328195d7
...
...
@@ -218,6 +218,7 @@ std::shared_ptr<imperative::VarBase> CastPyArg2VarBase(PyObject* obj,
void
SetPythonStack
()
{
if
(
FLAGS_check_nan_inf
)
{
VLOG
(
4
)
<<
"this is SetPythonStack"
;
pybind11
::
gil_scoped_acquire
gil
;
PyObject
*
mod
=
PyImport_ImportModule
(
"traceback"
);
PyObject
*
traceback_list
=
PyObject_CallMethod
(
mod
,
"format_stack"
,
""
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录