Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
54e1a7cc
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
54e1a7cc
编写于
9月 09, 2022
作者:
C
Chen Weihang
提交者:
GitHub
9月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
normalize yaml file name (#45894)
上级
3304e345
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
48 addition
and
50 deletion
+48
-50
paddle/fluid/eager/auto_code_generator/generator/CMakeLists.txt
.../fluid/eager/auto_code_generator/generator/CMakeLists.txt
+3
-3
paddle/fluid/eager/auto_code_generator/generator/eager_gen.py
...le/fluid/eager/auto_code_generator/generator/eager_gen.py
+5
-5
paddle/phi/api/lib/CMakeLists.txt
paddle/phi/api/lib/CMakeLists.txt
+11
-13
paddle/phi/api/lib/data_transform.cc
paddle/phi/api/lib/data_transform.cc
+1
-1
paddle/phi/api/yaml/generator/api_base.py
paddle/phi/api/yaml/generator/api_base.py
+1
-1
paddle/phi/api/yaml/generator/api_gen.py
paddle/phi/api/yaml/generator/api_gen.py
+1
-1
paddle/phi/api/yaml/generator/generate_op.py
paddle/phi/api/yaml/generator/generate_op.py
+4
-4
paddle/phi/api/yaml/generator/intermediate_api_gen.py
paddle/phi/api/yaml/generator/intermediate_api_gen.py
+2
-2
paddle/phi/api/yaml/generator/ops_extra_info_gen.py
paddle/phi/api/yaml/generator/ops_extra_info_gen.py
+13
-13
paddle/phi/api/yaml/generator/sparse_api_gen.py
paddle/phi/api/yaml/generator/sparse_api_gen.py
+2
-2
paddle/phi/api/yaml/generator/sparse_bw_api_gen.py
paddle/phi/api/yaml/generator/sparse_bw_api_gen.py
+1
-1
paddle/phi/api/yaml/generator/strings_api_gen.py
paddle/phi/api/yaml/generator/strings_api_gen.py
+1
-1
paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py
paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py
+1
-1
paddle/phi/api/yaml/legacy_ops.yaml
paddle/phi/api/yaml/legacy_ops.yaml
+1
-1
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+0
-0
paddle/phi/api/yaml/op_version.yaml
paddle/phi/api/yaml/op_version.yaml
+0
-0
paddle/phi/api/yaml/ops.yaml
paddle/phi/api/yaml/ops.yaml
+0
-0
paddle/phi/api/yaml/sparse_backward.yaml
paddle/phi/api/yaml/sparse_backward.yaml
+0
-0
paddle/phi/api/yaml/sparse_ops.yaml
paddle/phi/api/yaml/sparse_ops.yaml
+0
-0
paddle/phi/api/yaml/strings_ops.yaml
paddle/phi/api/yaml/strings_ops.yaml
+0
-0
paddle/phi/infermeta/unary.cc
paddle/phi/infermeta/unary.cc
+1
-1
未找到文件。
paddle/fluid/eager/auto_code_generator/generator/CMakeLists.txt
浏览文件 @
54e1a7cc
set
(
api_yaml_path
set
(
api_yaml_path
"
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/
api.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/legacy_api.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_api
.yaml"
"
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/
ops.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/legacy_ops.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_ops
.yaml"
)
)
set
(
backward_yaml_path
set
(
backward_yaml_path
"
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/backward.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/legacy_backward.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_b
w_api
.yaml"
"
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/backward.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/legacy_backward.yaml,
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_b
ackward
.yaml"
)
)
set
(
tmp_forwards_cc_path
set
(
tmp_forwards_cc_path
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/eager/api/generated/eager_generated/forwards/tmp_dygraph_functions.cc"
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/eager/api/generated/eager_generated/forwards/tmp_dygraph_functions.cc"
...
@@ -30,7 +30,7 @@ set(nodes_h_path
...
@@ -30,7 +30,7 @@ set(nodes_h_path
)
)
# StringTensor only needs forward api
# StringTensor only needs forward api
set
(
fwd_api_yaml_path
set
(
fwd_api_yaml_path
"
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/strings_
api
.yaml"
)
"
${
PADDLE_SOURCE_DIR
}
/paddle/phi/api/yaml/strings_
ops
.yaml"
)
message
(
"Final State Eager CodeGen"
)
message
(
"Final State Eager CodeGen"
)
add_custom_target
(
add_custom_target
(
...
...
paddle/fluid/eager/auto_code_generator/generator/eager_gen.py
浏览文件 @
54e1a7cc
...
@@ -570,15 +570,15 @@ class DygraphFunctionGeneratorBase(FunctionGeneratorBase):
...
@@ -570,15 +570,15 @@ class DygraphFunctionGeneratorBase(FunctionGeneratorBase):
grad_api_contents
=
self
.
grad_api_contents
grad_api_contents
=
self
.
grad_api_contents
assert
'api'
in
forward_api_contents
.
keys
(
assert
'api'
in
forward_api_contents
.
keys
(
),
"Unable to find
\"
api
\"
in
api
.yaml"
),
"Unable to find
\"
api
\"
in
ops
.yaml"
assert
'args'
in
forward_api_contents
.
keys
(
assert
'args'
in
forward_api_contents
.
keys
(
),
"Unable to find
\"
args
\"
in
api
.yaml"
),
"Unable to find
\"
args
\"
in
ops
.yaml"
assert
'output'
in
forward_api_contents
.
keys
(
assert
'output'
in
forward_api_contents
.
keys
(
),
"Unable to find
\"
output
\"
in
api
.yaml"
),
"Unable to find
\"
output
\"
in
ops
.yaml"
if
grad_api_contents
is
not
None
:
if
grad_api_contents
is
not
None
:
assert
'backward'
in
forward_api_contents
.
keys
(
assert
'backward'
in
forward_api_contents
.
keys
(
),
"Unable to find
\"
backward
\"
in
api
.yaml"
),
"Unable to find
\"
backward
\"
in
ops
.yaml"
assert
'args'
in
grad_api_contents
.
keys
(
assert
'args'
in
grad_api_contents
.
keys
(
),
"Unable to find
\"
args
\"
in backward.yaml"
),
"Unable to find
\"
args
\"
in backward.yaml"
assert
'output'
in
grad_api_contents
.
keys
(
assert
'output'
in
grad_api_contents
.
keys
(
...
@@ -2043,7 +2043,7 @@ if __name__ == "__main__":
...
@@ -2043,7 +2043,7 @@ if __name__ == "__main__":
api_yaml_path
=
api_yaml_paths
[
i
]
api_yaml_path
=
api_yaml_paths
[
i
]
# string api is forwrad only
# string api is forwrad only
if
not
api_yaml_path
.
endswith
(
'strings_
api
.yaml'
):
if
not
api_yaml_path
.
endswith
(
'strings_
ops
.yaml'
):
backward_yaml_path
=
backward_yaml_paths
[
i
]
backward_yaml_path
=
backward_yaml_paths
[
i
]
else
:
else
:
backward_yaml_path
=
None
backward_yaml_path
=
None
...
...
paddle/phi/api/lib/CMakeLists.txt
浏览文件 @
54e1a7cc
...
@@ -21,9 +21,9 @@ set(api_gen_base ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/api_base.py)
...
@@ -21,9 +21,9 @@ set(api_gen_base ${CMAKE_SOURCE_DIR}/paddle/phi/api/yaml/generator/api_base.py)
# forward api file
# forward api file
set
(
api_gen_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/api_gen.py
)
set
(
api_gen_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/api_gen.py
)
set
(
api_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/
api
.yaml
)
set
(
api_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/
ops
.yaml
)
set
(
legacy_api_yaml_file
set
(
legacy_api_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/legacy_
api
.yaml
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/legacy_
ops
.yaml
)
set
(
api_header_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/include/api.h
)
set
(
api_header_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/include/api.h
)
set
(
api_source_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/lib/api.cc
)
set
(
api_source_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/lib/api.cc
)
set
(
api_header_file_tmp
${
api_header_file
}
.tmp
)
set
(
api_header_file_tmp
${
api_header_file
}
.tmp
)
...
@@ -55,7 +55,7 @@ set(dygraph_api_source_file_tmp ${dygraph_api_source_file}.tmp)
...
@@ -55,7 +55,7 @@ set(dygraph_api_source_file_tmp ${dygraph_api_source_file}.tmp)
set
(
sparse_api_gen_file
set
(
sparse_api_gen_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/sparse_api_gen.py
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/sparse_api_gen.py
)
set
(
sparse_api_yaml_file
set
(
sparse_api_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_
api
.yaml
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_
ops
.yaml
)
set
(
sparse_api_header_file
set
(
sparse_api_header_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/include/sparse_api.h
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/include/sparse_api.h
)
set
(
sparse_api_source_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/lib/sparse_api.cc
)
set
(
sparse_api_source_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/lib/sparse_api.cc
)
...
@@ -66,7 +66,7 @@ set(sparse_api_source_file_tmp ${sparse_api_source_file}.tmp)
...
@@ -66,7 +66,7 @@ set(sparse_api_source_file_tmp ${sparse_api_source_file}.tmp)
set
(
sparse_bw_api_gen_file
set
(
sparse_bw_api_gen_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/sparse_bw_api_gen.py
)
set
(
sparse_bw_api_yaml_file
set
(
sparse_bw_api_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_b
w_api
.yaml
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/sparse_b
ackward
.yaml
)
set
(
sparse_bw_api_header_file
set
(
sparse_bw_api_header_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/backward/sparse_bw_api.h
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/backward/sparse_bw_api.h
)
set
(
sparse_bw_api_source_file
set
(
sparse_bw_api_source_file
...
@@ -78,7 +78,7 @@ set(sparse_bw_api_source_file_tmp ${sparse_bw_api_source_file}.tmp)
...
@@ -78,7 +78,7 @@ set(sparse_bw_api_source_file_tmp ${sparse_bw_api_source_file}.tmp)
set
(
strings_api_gen_file
set
(
strings_api_gen_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/strings_api_gen.py
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/strings_api_gen.py
)
set
(
strings_api_yaml_file
set
(
strings_api_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/strings_
api
.yaml
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/strings_
ops
.yaml
)
set
(
strings_api_header_file
set
(
strings_api_header_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/include/strings_api.h
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/include/strings_api.h
)
set
(
strings_api_source_file
set
(
strings_api_source_file
...
@@ -97,8 +97,7 @@ set(wrapped_infermeta_source_file
...
@@ -97,8 +97,7 @@ set(wrapped_infermeta_source_file
# op extra info file
# op extra info file
set
(
ops_extra_info_gen_file
set
(
ops_extra_info_gen_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/ops_extra_info_gen.py
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/generator/ops_extra_info_gen.py
)
set
(
api_compat_yaml_file
set
(
op_compat_yaml_file
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/op_compat.yaml
)
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml/api_compat.yaml
)
set
(
ops_extra_info_file
set
(
ops_extra_info_file
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/operators/ops_extra_info.cc
)
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/operators/ops_extra_info.cc
)
...
@@ -130,10 +129,10 @@ message(
...
@@ -130,10 +129,10 @@ message(
execute_process
(
execute_process
(
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/paddle/phi/api/yaml
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
parsed_api_dir
}
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
parsed_api_dir
}
COMMAND
${
PYTHON_EXECUTABLE
}
generator/parse_api.py --api_yaml_path ./
api
.yaml
COMMAND
${
PYTHON_EXECUTABLE
}
generator/parse_api.py --api_yaml_path ./
ops
.yaml
--output_path ./parsed_apis/api.parsed.yaml
--output_path ./parsed_apis/api.parsed.yaml
COMMAND
${
PYTHON_EXECUTABLE
}
generator/parse_api.py --api_yaml_path
COMMAND
${
PYTHON_EXECUTABLE
}
generator/parse_api.py --api_yaml_path
./legacy_
api
.yaml --output_path ./parsed_apis/legacy_api.parsed.yaml
./legacy_
ops
.yaml --output_path ./parsed_apis/legacy_api.parsed.yaml
COMMAND
COMMAND
${
PYTHON_EXECUTABLE
}
generator/parse_api.py --api_yaml_path ./backward.yaml
${
PYTHON_EXECUTABLE
}
generator/parse_api.py --api_yaml_path ./backward.yaml
--output_path ./parsed_apis/backward_api.parsed.yaml --backward
--output_path ./parsed_apis/backward_api.parsed.yaml --backward
...
@@ -175,7 +174,7 @@ execute_process(
...
@@ -175,7 +174,7 @@ execute_process(
${
PYTHON_EXECUTABLE
}
generator/generate_op.py --api_yaml_path
${
PYTHON_EXECUTABLE
}
generator/generate_op.py --api_yaml_path
./parsed_apis/api.parsed.yaml --backward_api_yaml_path
./parsed_apis/api.parsed.yaml --backward_api_yaml_path
./parsed_apis/backward_api.parsed.yaml --api_version_yaml_path
./parsed_apis/backward_api.parsed.yaml --api_version_yaml_path
api_version.yaml --api_compat_yaml_path api
_compat.yaml --output_op_path
op_version.yaml --op_compat_yaml_path op
_compat.yaml --output_op_path
"
${
generated_op_path
}
.tmp"
--output_arg_map_path
"
${
generated_op_path
}
.tmp"
--output_arg_map_path
"
${
generated_argument_mapping_path
}
.tmp"
"
${
generated_argument_mapping_path
}
.tmp"
RESULT_VARIABLE _result
)
RESULT_VARIABLE _result
)
...
@@ -221,9 +220,8 @@ endif()
...
@@ -221,9 +220,8 @@ endif()
# generate ops extra info
# generate ops extra info
execute_process
(
execute_process
(
COMMAND
COMMAND
${
PYTHON_EXECUTABLE
}
${
ops_extra_info_gen_file
}
--op_compat_yaml_path
${
PYTHON_EXECUTABLE
}
${
ops_extra_info_gen_file
}
--api_compat_yaml_path
${
op_compat_yaml_file
}
--ops_extra_info_path
${
ops_extra_info_file
}
)
${
api_compat_yaml_file
}
--ops_extra_info_path
${
ops_extra_info_file
}
)
message
(
"generate
${
ops_extra_info_file
}
"
)
message
(
"generate
${
ops_extra_info_file
}
"
)
# generate forward api
# generate forward api
...
...
paddle/phi/api/lib/data_transform.cc
浏览文件 @
54e1a7cc
...
@@ -40,7 +40,7 @@ inline bool NeedTransformPlace(const paddle::platform::Place& input,
...
@@ -40,7 +40,7 @@ inline bool NeedTransformPlace(const paddle::platform::Place& input,
const
TransformFlag
&
transform_flag
)
{
const
TransformFlag
&
transform_flag
)
{
// NOTE(dev): The default value of TransformFlag is True, if it is set with
// NOTE(dev): The default value of TransformFlag is True, if it is set with
// False
// False
// somewhere such as
api
.yaml or backward.yaml that means we should skip data
// somewhere such as
ops
.yaml or backward.yaml that means we should skip data
// transform. Because "stop_transform_" has highest priority.
// transform. Because "stop_transform_" has highest priority.
if
(
!
transform_flag
.
need_trans_backend
())
{
if
(
!
transform_flag
.
need_trans_backend
())
{
return
false
;
return
false
;
...
...
paddle/phi/api/yaml/generator/api_base.py
浏览文件 @
54e1a7cc
...
@@ -881,7 +881,7 @@ PADDLE_API {self.get_return_type(inplace_flag=True)} {api_func_name}({self.get_d
...
@@ -881,7 +881,7 @@ PADDLE_API {self.get_return_type(inplace_flag=True)} {api_func_name}({self.get_d
def
get_condition_code
(
self
,
kernel_name
):
def
get_condition_code
(
self
,
kernel_name
):
assert
self
.
kernel
[
'dispatch'
][
kernel_name
],
\
assert
self
.
kernel
[
'dispatch'
][
kernel_name
],
\
f
"
{
self
.
api
}
api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'scale' in
api
.yaml."
f
"
{
self
.
api
}
api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'scale' in
ops
.yaml."
input_types
=
self
.
kernel
[
'dispatch'
][
kernel_name
][
0
]
input_types
=
self
.
kernel
[
'dispatch'
][
kernel_name
][
0
]
condition_list
=
[]
condition_list
=
[]
for
i
,
in_type
in
enumerate
(
input_types
):
for
i
,
in_type
in
enumerate
(
input_types
):
...
...
paddle/phi/api/yaml/generator/api_gen.py
浏览文件 @
54e1a7cc
...
@@ -319,7 +319,7 @@ def main():
...
@@ -319,7 +319,7 @@ def main():
parser
.
add_argument
(
'--api_yaml_path'
,
parser
.
add_argument
(
'--api_yaml_path'
,
help
=
'path to api yaml file'
,
help
=
'path to api yaml file'
,
nargs
=
'+'
,
nargs
=
'+'
,
default
=
'paddle/phi/api/yaml/
api
.yaml'
)
default
=
'paddle/phi/api/yaml/
ops
.yaml'
)
parser
.
add_argument
(
'--api_header_path'
,
parser
.
add_argument
(
'--api_header_path'
,
help
=
'output of generated api header code file'
,
help
=
'output of generated api header code file'
,
...
...
paddle/phi/api/yaml/generator/generate_op.py
浏览文件 @
54e1a7cc
...
@@ -175,7 +175,7 @@ def replace_compat_name(api_op_map, forward_api_dict, backward_api_dict):
...
@@ -175,7 +175,7 @@ def replace_compat_name(api_op_map, forward_api_dict, backward_api_dict):
]
]
def
main
(
api_yaml_path
,
backward_yaml_path
,
api
_compat_yaml_path
,
def
main
(
api_yaml_path
,
backward_yaml_path
,
op
_compat_yaml_path
,
api_version_yaml_path
,
output_op_path
,
output_arg_map_path
):
api_version_yaml_path
,
output_op_path
,
output_arg_map_path
):
with
open
(
api_yaml_path
,
"rt"
)
as
f
:
with
open
(
api_yaml_path
,
"rt"
)
as
f
:
apis
=
yaml
.
safe_load
(
f
)
apis
=
yaml
.
safe_load
(
f
)
...
@@ -193,7 +193,7 @@ def main(api_yaml_path, backward_yaml_path, api_compat_yaml_path,
...
@@ -193,7 +193,7 @@ def main(api_yaml_path, backward_yaml_path, api_compat_yaml_path,
for
api_version
in
api_versions
:
for
api_version
in
api_versions
:
forward_api_dict
[
api_version
[
'api'
]][
'version'
]
=
api_version
[
'version'
]
forward_api_dict
[
api_version
[
'api'
]][
'version'
]
=
api_version
[
'version'
]
with
open
(
api
_compat_yaml_path
,
"rt"
)
as
f
:
with
open
(
op
_compat_yaml_path
,
"rt"
)
as
f
:
api_op_map
=
yaml
.
safe_load
(
f
)
api_op_map
=
yaml
.
safe_load
(
f
)
for
api
in
apis
:
for
api
in
apis
:
...
@@ -244,7 +244,7 @@ if __name__ == "__main__":
...
@@ -244,7 +244,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
'--backward_api_yaml_path'
,
parser
.
add_argument
(
'--backward_api_yaml_path'
,
type
=
str
,
type
=
str
,
help
=
"parsed backward api yaml file."
)
help
=
"parsed backward api yaml file."
)
parser
.
add_argument
(
'--
api
_compat_yaml_path'
,
parser
.
add_argument
(
'--
op
_compat_yaml_path'
,
type
=
str
,
type
=
str
,
help
=
"api args compat yaml file."
)
help
=
"api args compat yaml file."
)
parser
.
add_argument
(
'--api_version_yaml_path'
,
parser
.
add_argument
(
'--api_version_yaml_path'
,
...
@@ -260,5 +260,5 @@ if __name__ == "__main__":
...
@@ -260,5 +260,5 @@ if __name__ == "__main__":
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
main
(
args
.
api_yaml_path
,
args
.
backward_api_yaml_path
,
main
(
args
.
api_yaml_path
,
args
.
backward_api_yaml_path
,
args
.
api
_compat_yaml_path
,
args
.
api_version_yaml_path
,
args
.
op
_compat_yaml_path
,
args
.
api_version_yaml_path
,
args
.
output_op_path
,
args
.
output_arg_map_path
)
args
.
output_op_path
,
args
.
output_arg_map_path
)
paddle/phi/api/yaml/generator/intermediate_api_gen.py
浏览文件 @
54e1a7cc
...
@@ -135,11 +135,11 @@ def main():
...
@@ -135,11 +135,11 @@ def main():
parser
.
add_argument
(
'--api_yaml_path'
,
parser
.
add_argument
(
'--api_yaml_path'
,
nargs
=
'+'
,
nargs
=
'+'
,
help
=
'path to api yaml file'
,
help
=
'path to api yaml file'
,
default
=
'paddle/phi/api/yaml/
api
.yaml'
)
default
=
'paddle/phi/api/yaml/
ops
.yaml'
)
parser
.
add_argument
(
'--sparse_api_yaml_path'
,
parser
.
add_argument
(
'--sparse_api_yaml_path'
,
help
=
'path to sparse api yaml file'
,
help
=
'path to sparse api yaml file'
,
default
=
'paddle/phi/api/yaml/sparse_
api
.yaml'
)
default
=
'paddle/phi/api/yaml/sparse_
ops
.yaml'
)
parser
.
add_argument
(
'--dygraph_api_header_path'
,
parser
.
add_argument
(
'--dygraph_api_header_path'
,
help
=
'output of generated dygraph api header code file'
,
help
=
'output of generated dygraph api header code file'
,
...
...
paddle/phi/api/yaml/generator/ops_extra_info_gen.py
浏览文件 @
54e1a7cc
...
@@ -65,9 +65,9 @@ def parse_attr(attr_str):
...
@@ -65,9 +65,9 @@ def parse_attr(attr_str):
'name'
),
result
.
group
(
'default_val'
)
'name'
),
result
.
group
(
'default_val'
)
def
generate_extra_info
(
api
_compat_yaml_path
,
ops_extra_info_path
):
def
generate_extra_info
(
op
_compat_yaml_path
,
ops_extra_info_path
):
compat_apis
=
[]
compat_apis
=
[]
with
open
(
api
_compat_yaml_path
,
'rt'
)
as
f
:
with
open
(
op
_compat_yaml_path
,
'rt'
)
as
f
:
compat_apis
=
yaml
.
safe_load
(
f
)
compat_apis
=
yaml
.
safe_load
(
f
)
def
get_op_name
(
api_item
):
def
get_op_name
(
api_item
):
...
@@ -80,9 +80,9 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
...
@@ -80,9 +80,9 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
extra_map_str_list
=
[]
extra_map_str_list
=
[]
extra_checker_str_list
=
[]
extra_checker_str_list
=
[]
for
api
_compat_args
in
compat_apis
:
for
op
_compat_args
in
compat_apis
:
if
'extra'
in
api
_compat_args
:
if
'extra'
in
op
_compat_args
:
extra_args_map
=
api
_compat_args
[
'extra'
]
extra_args_map
=
op
_compat_args
[
'extra'
]
# TODO(chenweihang): add inputs and outputs
# TODO(chenweihang): add inputs and outputs
if
'attrs'
in
extra_args_map
:
if
'attrs'
in
extra_args_map
:
attr_map_list
=
[]
attr_map_list
=
[]
...
@@ -103,13 +103,13 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
...
@@ -103,13 +103,13 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
api_extra_attr_checkers
=
",
\n
"
.
join
(
api_extra_attr_checkers
=
",
\n
"
.
join
(
attr_checker_func_list
)
attr_checker_func_list
)
extra_map_str_list
.
append
(
extra_map_str_list
.
append
(
f
"{{
\"
{
get_op_name
(
api
_compat_args
[
'api'
])
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
f
"{{
\"
{
get_op_name
(
op
_compat_args
[
'api'
])
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
)
)
extra_checker_str_list
.
append
(
extra_checker_str_list
.
append
(
f
"{{
\"
{
get_op_name
(
api
_compat_args
[
'api'
])
}
\"
, {{
{
api_extra_attr_checkers
}
}}}}"
f
"{{
\"
{
get_op_name
(
op
_compat_args
[
'api'
])
}
\"
, {{
{
api_extra_attr_checkers
}
}}}}"
)
)
if
'backward'
in
api
_compat_args
:
if
'backward'
in
op
_compat_args
:
for
bw_item
in
api
_compat_args
[
'backward'
].
split
(
','
):
for
bw_item
in
op
_compat_args
[
'backward'
].
split
(
','
):
bw_op_name
=
get_op_name
(
bw_item
)
bw_op_name
=
get_op_name
(
bw_item
)
extra_map_str_list
.
append
(
extra_map_str_list
.
append
(
f
"{{
\"
{
bw_op_name
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
)
f
"{{
\"
{
bw_op_name
}
\"
, {{
{
api_extra_attr_map
}
}}}}"
)
...
@@ -127,9 +127,9 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
...
@@ -127,9 +127,9 @@ def generate_extra_info(api_compat_yaml_path, ops_extra_info_path):
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
description
=
'Generate PaddlePaddle Extra Param Info for Op'
)
description
=
'Generate PaddlePaddle Extra Param Info for Op'
)
parser
.
add_argument
(
'--
api
_compat_yaml_path'
,
parser
.
add_argument
(
'--
op
_compat_yaml_path'
,
help
=
'path to api compat yaml file'
,
help
=
'path to api compat yaml file'
,
default
=
'paddle/phi/api/yaml/
api
_compat.yaml'
)
default
=
'paddle/phi/api/yaml/
op
_compat.yaml'
)
parser
.
add_argument
(
'--ops_extra_info_path'
,
parser
.
add_argument
(
'--ops_extra_info_path'
,
help
=
'output of generated extra_prama_info code file'
,
help
=
'output of generated extra_prama_info code file'
,
...
@@ -137,10 +137,10 @@ def main():
...
@@ -137,10 +137,10 @@ def main():
options
=
parser
.
parse_args
()
options
=
parser
.
parse_args
()
api_compat_yaml_path
=
options
.
api
_compat_yaml_path
op_compat_yaml_path
=
options
.
op
_compat_yaml_path
ops_extra_info_path
=
options
.
ops_extra_info_path
ops_extra_info_path
=
options
.
ops_extra_info_path
generate_extra_info
(
api
_compat_yaml_path
,
ops_extra_info_path
)
generate_extra_info
(
op
_compat_yaml_path
,
ops_extra_info_path
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
paddle/phi/api/yaml/generator/sparse_api_gen.py
浏览文件 @
54e1a7cc
...
@@ -160,7 +160,7 @@ class SparseAPI(ForwardAPI):
...
@@ -160,7 +160,7 @@ class SparseAPI(ForwardAPI):
def
get_condition_code
(
self
,
kernel_name
):
def
get_condition_code
(
self
,
kernel_name
):
assert
self
.
kernel
[
'dispatch'
][
kernel_name
],
\
assert
self
.
kernel
[
'dispatch'
][
kernel_name
],
\
f
"
{
self
.
api
}
api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'conv3d' in sparse_
api
.yaml."
f
"
{
self
.
api
}
api: the tensor type of inputs and outputs for kernel isn't set, see also 'kernel:func' of 'conv3d' in sparse_
ops
.yaml."
input_types
=
self
.
kernel
[
'dispatch'
][
kernel_name
][
0
]
input_types
=
self
.
kernel
[
'dispatch'
][
kernel_name
][
0
]
sparse_type_map
=
{
sparse_type_map
=
{
'sparse_coo'
:
'DataLayout::SPARSE_COO'
,
'sparse_coo'
:
'DataLayout::SPARSE_COO'
,
...
@@ -284,7 +284,7 @@ def main():
...
@@ -284,7 +284,7 @@ def main():
description
=
'Generate PaddlePaddle C++ Sparse API files'
)
description
=
'Generate PaddlePaddle C++ Sparse API files'
)
parser
.
add_argument
(
'--api_yaml_path'
,
parser
.
add_argument
(
'--api_yaml_path'
,
help
=
'path to sparse api yaml file'
,
help
=
'path to sparse api yaml file'
,
default
=
'paddle/phi/api/yaml/sparse_
api
.yaml'
)
default
=
'paddle/phi/api/yaml/sparse_
ops
.yaml'
)
parser
.
add_argument
(
'--api_header_path'
,
parser
.
add_argument
(
'--api_header_path'
,
help
=
'output of generated api header code file'
,
help
=
'output of generated api header code file'
,
...
...
paddle/phi/api/yaml/generator/sparse_bw_api_gen.py
浏览文件 @
54e1a7cc
...
@@ -164,7 +164,7 @@ def main():
...
@@ -164,7 +164,7 @@ def main():
description
=
'Generate PaddlePaddle C++ Sparse API files'
)
description
=
'Generate PaddlePaddle C++ Sparse API files'
)
parser
.
add_argument
(
'--api_yaml_path'
,
parser
.
add_argument
(
'--api_yaml_path'
,
help
=
'path to sparse api yaml file'
,
help
=
'path to sparse api yaml file'
,
default
=
'paddle/phi/api/yaml/sparse_b
w_api
.yaml'
)
default
=
'paddle/phi/api/yaml/sparse_b
ackward
.yaml'
)
parser
.
add_argument
(
'--api_header_path'
,
parser
.
add_argument
(
'--api_header_path'
,
help
=
'output of generated api header code file'
,
help
=
'output of generated api header code file'
,
...
...
paddle/phi/api/yaml/generator/strings_api_gen.py
浏览文件 @
54e1a7cc
...
@@ -351,7 +351,7 @@ def main():
...
@@ -351,7 +351,7 @@ def main():
description
=
'Generate PaddlePaddle C++ Strings API files'
)
description
=
'Generate PaddlePaddle C++ Strings API files'
)
parser
.
add_argument
(
'--api_yaml_path'
,
parser
.
add_argument
(
'--api_yaml_path'
,
help
=
'path to sparse api yaml file'
,
help
=
'path to sparse api yaml file'
,
default
=
'paddle/phi/api/yaml/strings_
api
.yaml'
)
default
=
'paddle/phi/api/yaml/strings_
ops
.yaml'
)
parser
.
add_argument
(
'--api_header_path'
,
parser
.
add_argument
(
'--api_header_path'
,
help
=
'output of generated api header code file'
,
help
=
'output of generated api header code file'
,
...
...
paddle/phi/api/yaml/generator/wrapped_infermeta_gen.py
浏览文件 @
54e1a7cc
...
@@ -167,7 +167,7 @@ def main():
...
@@ -167,7 +167,7 @@ def main():
parser
.
add_argument
(
'--api_yaml_path'
,
parser
.
add_argument
(
'--api_yaml_path'
,
help
=
'path to api yaml file'
,
help
=
'path to api yaml file'
,
nargs
=
'+'
,
nargs
=
'+'
,
default
=
'paddle/phi/api/yaml/
api
.yaml'
)
default
=
'paddle/phi/api/yaml/
ops
.yaml'
)
parser
.
add_argument
(
parser
.
add_argument
(
'--wrapped_infermeta_header_path'
,
'--wrapped_infermeta_header_path'
,
help
=
'output of generated wrapped_infermeta header code file'
,
help
=
'output of generated wrapped_infermeta header code file'
,
...
...
paddle/phi/api/yaml/legacy_
api
.yaml
→
paddle/phi/api/yaml/legacy_
ops
.yaml
浏览文件 @
54e1a7cc
# The apis in this file are unstandardized that may caused by a variety of reasons,
# The apis in this file are unstandardized that may caused by a variety of reasons,
# we are trying to fix these apis and will move standardized apis into
api
.yaml.
# we are trying to fix these apis and will move standardized apis into
ops
.yaml.
-
api
:
abs
-
api
:
abs
args
:
(Tensor x)
args
:
(Tensor x)
...
...
paddle/phi/api/yaml/
api
_compat.yaml
→
paddle/phi/api/yaml/
op
_compat.yaml
浏览文件 @
54e1a7cc
文件已移动
paddle/phi/api/yaml/
api
_version.yaml
→
paddle/phi/api/yaml/
op
_version.yaml
浏览文件 @
54e1a7cc
文件已移动
paddle/phi/api/yaml/
api
.yaml
→
paddle/phi/api/yaml/
ops
.yaml
浏览文件 @
54e1a7cc
文件已移动
paddle/phi/api/yaml/sparse_b
w_api
.yaml
→
paddle/phi/api/yaml/sparse_b
ackward
.yaml
浏览文件 @
54e1a7cc
文件已移动
paddle/phi/api/yaml/sparse_
api
.yaml
→
paddle/phi/api/yaml/sparse_
ops
.yaml
浏览文件 @
54e1a7cc
文件已移动
paddle/phi/api/yaml/strings_
api
.yaml
→
paddle/phi/api/yaml/strings_
ops
.yaml
浏览文件 @
54e1a7cc
文件已移动
paddle/phi/infermeta/unary.cc
浏览文件 @
54e1a7cc
...
@@ -3537,7 +3537,7 @@ void StridedSliceInferMeta(const MetaTensor& x,
...
@@ -3537,7 +3537,7 @@ void StridedSliceInferMeta(const MetaTensor& x,
/* Why not use SumRawInferMeta directly?
/* Why not use SumRawInferMeta directly?
Because we need make InferMetaFunction's args follow the design of
Because we need make InferMetaFunction's args follow the design of
api
.yaml
ops
.yaml
*/
*/
void
SumInferMeta
(
const
MetaTensor
&
x
,
void
SumInferMeta
(
const
MetaTensor
&
x
,
const
IntArray
&
axis
,
const
IntArray
&
axis
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录