Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6cb53e91
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看板
未验证
提交
6cb53e91
编写于
5月 19, 2023
作者:
X
xiaoguoguo626807
提交者:
GitHub
5月 19, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【prim】merge branch for GradOpMaker codeGen to clear code (#53874)
* review * modify opcompat bug * modify pybind
上级
14e0ce71
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
13 deletion
+17
-13
paddle/fluid/operators/generator/templates/operator_utils.c.j2
...e/fluid/operators/generator/templates/operator_utils.c.j2
+3
-4
paddle/fluid/operators/generator/tests_utils.py
paddle/fluid/operators/generator/tests_utils.py
+5
-0
paddle/fluid/prim/api/composite_backward/composite_double_backward_api.h
...im/api/composite_backward/composite_double_backward_api.h
+1
-1
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+2
-2
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+6
-6
未找到文件。
paddle/fluid/operators/generator/templates/operator_utils.c.j2
浏览文件 @
6cb53e91
...
...
@@ -472,15 +472,14 @@ REGISTER_OPERATOR({{name}}, ops::{{name | to_pascal_case}}Op,
{% if not "forward" in op %}{# it is a forward op #}
ops::{{name | to_pascal_case}}OpMaker,
{% endif %}
{% if "only_backward_composite" in op and op["only_backward_composite"] is true %}{# backward #}
{% elif "backward" in op and op["backward"] is not none %}
{% if "backward" in op and op["backward"] is not none and op["only_backward_composite"] is false%}{# backward #}
{% set backward_name = op["backward"] %}
ops::{{backward_name | to_pascal_case}}OpMaker<paddle::framework::OpDesc>,
ops::{{backward_name | to_pascal_case}}OpMaker<paddle::imperative::OpBase>,
{% elif "forward" in op %}
{% else %}
{% elif "forward" not in op %}
paddle::framework::EmptyGradOpMaker<paddle::framework::OpDesc>,
paddle::framework::EmptyGradOpMaker<paddle::imperative::OpBase>,
{% else %}
{% endif %}
{% if op is supports_inplace %}{# inplace#}
ops::{{name | to_pascal_case}}InplaceInferer,
...
...
paddle/fluid/operators/generator/tests_utils.py
浏览文件 @
6cb53e91
...
...
@@ -54,10 +54,15 @@ def is_base_op(op):
return
"kernel"
in
op
and
"infer_meta"
in
op
# this func describe a op that only has composite implementation,
# without kernel implementation. kernel implementation include
# other op (invoke) or c++ kernel (kernel + infermeta)
def
is_only_composite_op
(
op
):
return
"composite"
in
op
and
"kernel"
not
in
op
and
"invoke"
not
in
op
# this func describe a op that has composite implementation,
# maybe also has kernel implementation.
def
is_composite_op
(
op
):
return
"composite"
in
op
...
...
paddle/fluid/prim/api/composite_backward/composite_double_backward_api.h
浏览文件 @
6cb53e91
// Copyright (c) 202
2
PaddlePaddle Authors. All Rights Reserved.
// Copyright (c) 202
3
PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
...
...
paddle/fluid/pybind/pybind.cc
浏览文件 @
6cb53e91
...
...
@@ -1363,12 +1363,12 @@ All parameter, weight, gradient are variables in Paddle.
}
}
else
{
if
(
grad_op_maker
!=
nullptr
)
{
VLOG
(
3
)
<<
"Prim Flag Close: Runing origin grad fun for "
VLOG
(
6
)
<<
"Prim Flag Close: Runing origin grad fun for "
<<
op_desc
.
Type
();
grad_op_descs
=
grad_op_maker
(
op_desc
,
no_grad_set
,
&
grad_to_var
,
grad_sub_block
);
}
else
{
VLOG
(
3
)
<<
"Prim Flag Close: Runing composite grad fun for "
VLOG
(
6
)
<<
"Prim Flag Close: Runing composite grad fun for "
<<
op_desc
.
Type
();
grad_op_descs
=
grad_comp_op_maker
(
op_desc
,
no_grad_set
,
...
...
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
6cb53e91
...
...
@@ -1525,12 +1525,6 @@
attrs
:
[
bool use_mkldnn = false
,
str mkldnn_data_type = "float32"
,
bool use_quantizer = false
,
float Scale_x = 1.0f
,
float Scale_y = 1.0f
,
float Scale_out = 1.0f
]
-
op
:
maximum (elementwise_min)
backward
:
maximum_grad (elementwise_min_grad)
extra
:
attrs
:
[
bool use_mkldnn = false
,
str mkldnn_data_type = "float32"
,
bool use_quantizer = false
,
float Scale_x = 1.0f
,
float Scale_y = 1.0f
,
float Scale_out = 1.0f
]
-
op
:
maxout
inputs
:
x
:
X
...
...
@@ -1591,6 +1585,12 @@
out
:
Out
drop_empty_grad
:
[
inputs_grad
]
-
op
:
minimum (elementwise_min)
backward
:
minimum_grad (elementwise_min_grad)
extra
:
attrs
:
[
bool use_mkldnn = false
,
str x_data_format = ""
,
str y_data_format = ""
,
str mkldnn_data_type = "float32"
,
bool use_quantizer = false
,
float Scale_x = 1.0f
,
float Scale_y = 1.0f
,
float Scale_out = 1.0f
]
-
op
:
mish
backward
:
mish_grad
extra
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录