Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f9882854
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
f9882854
编写于
9月 02, 2022
作者:
Z
zyfncg
提交者:
GitHub
9月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adjust the rule of configure in api_compat.yaml (#45672)
* set use_cudnn=true for conv2d * refine the config rule of api_compat
上级
e2823c8c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
18 deletion
+36
-18
paddle/phi/api/yaml/api_compat.yaml
paddle/phi/api/yaml/api_compat.yaml
+2
-3
paddle/phi/api/yaml/generator/generate_op.py
paddle/phi/api/yaml/generator/generate_op.py
+18
-7
paddle/phi/api/yaml/generator/ops_extra_info_gen.py
paddle/phi/api/yaml/generator/ops_extra_info_gen.py
+16
-8
未找到文件。
paddle/phi/api/yaml/api_compat.yaml
浏览文件 @
f9882854
...
...
@@ -123,9 +123,8 @@
str fuse_activation = ""
,
float fuse_alpha = 0.0f
,
float fuse_beta = 0.0f
,
int workspace_size_MB = platform
::
GetDefaultConvWorkspaceSizeLimitMB()
]
-
api
:
diag
op_name
:
diag_v2
grad_op_name
:
diag_v2_grad
-
api
:
diag (diag_v2)
backward
:
diag_grad (diag_v2_grad)
inputs
:
x
:
X
outputs
:
...
...
paddle/phi/api/yaml/generator/generate_op.py
浏览文件 @
f9882854
...
...
@@ -56,18 +56,29 @@ def restruct_io(api):
# replace name of op and params for OpMaker
def
replace_compat_name
(
api_op_map
,
forward_api_dict
,
backward_api_dict
):
def
get_api_and_op_name
(
api_item
):
names
=
api_item
.
split
(
'('
)
if
len
(
names
)
==
1
:
return
names
[
0
].
strip
(),
names
[
0
].
strip
()
else
:
return
names
[
0
].
strip
(),
names
[
1
].
split
(
')'
)[
0
].
strip
()
for
api_args
in
api_op_map
:
if
api_args
[
'api'
]
not
in
forward_api_dict
:
api_name
,
op_name
=
get_api_and_op_name
(
api_args
[
'api'
])
if
api_name
not
in
forward_api_dict
:
continue
forward_api_item
=
forward_api_dict
[
api_
args
[
'api'
]
]
forward_api_item
=
forward_api_dict
[
api_
name
]
has_backward
=
True
if
forward_api_item
[
'backward'
]
else
False
if
has_backward
:
backward_api_item
=
backward_api_dict
[
forward_api_item
[
'backward'
]]
if
'op_name'
in
api_args
:
forward_api_item
[
'op_name'
]
=
api_args
[
'op_name'
]
if
'grad_op_name'
in
api_args
and
has_backward
:
forward_api_item
[
'backward'
]
=
api_args
[
'grad_op_name'
]
backward_api_item
[
'op_name'
]
=
api_args
[
'grad_op_name'
]
if
api_name
!=
op_name
:
forward_api_item
[
'op_name'
]
=
op_name
if
'backward'
in
api_args
and
has_backward
:
bw_api_name
,
bw_op_name
=
get_api_and_op_name
(
api_args
[
'backward'
].
split
(
','
)[
0
])
forward_api_item
[
'backward'
]
=
bw_op_name
backward_api_item
[
'op_name'
]
=
bw_op_name
key_set
=
[
'inputs'
,
'attrs'
,
'outputs'
]
args_map
=
{}
...
...
paddle/phi/api/yaml/generator/ops_extra_info_gen.py
浏览文件 @
f9882854
...
...
@@ -70,6 +70,13 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
with
open
(
api_compat_yaml_path
,
'rt'
)
as
f
:
compat_apis
=
yaml
.
safe_load
(
f
)
def
get_op_name
(
api_item
):
names
=
api_item
.
split
(
'('
)
if
len
(
names
)
==
1
:
return
names
[
0
].
strip
()
else
:
return
names
[
1
].
split
(
')'
)[
0
].
strip
()
extra_map_str_list
=
[]
extra_checker_str_list
=
[]
...
...
@@ -96,18 +103,19 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
api_extra_attr_checkers
=
",
\n
"
.
join
(
attr_checker_func_list
)
extra_map_str_list
.
append
(
f
"{{
\"
{
api_compat_args
[
'api'
]
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
f
"{{
\"
{
get_op_name
(
api_compat_args
[
'api'
])
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
)
extra_checker_str_list
.
append
(
f
"{{
\"
{
api_compat_args
[
'api'
]
}
\"
, {{
{
api_extra_attr_checkers
}
}}}}"
f
"{{
\"
{
get_op_name
(
api_compat_args
[
'api'
])
}
\"
, {{
{
api_extra_attr_checkers
}
}}}}"
)
if
'backward'
in
api_compat_args
:
extra_map_str_list
.
append
(
f
"{{
\"
{
api_compat_args
[
'backward'
]
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
)
extra_checker_str_list
.
append
(
f
"{{
\"
{
api_compat_args
[
'backward'
]
}
\"
, {{
{
api_extra_attr_checkers
}
}}}}"
)
for
bw_item
in
api_compat_args
[
'backward'
].
split
(
','
):
bw_op_name
=
get_op_name
(
bw_item
)
extra_map_str_list
.
append
(
f
"{{
\"
{
bw_op_name
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
)
extra_checker_str_list
.
append
(
f
"{{
\"
{
bw_op_name
}
\"
, {{
{
api_extra_attr_checkers
}
}}}}"
)
ops_extra_info_file
=
open
(
ops_extra_info_path
,
'w'
)
ops_extra_info_file
.
write
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录