Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Others
PR changes
Others
Description
添加 elementwise_add 的算子参数映射
修复流程简单教学:
假设你要修复的算子是
xxx
,你要做的是,1. 首先判断是否有别名:
项目内搜索
PD_REGISTER_BASE_KERNEL_NAME(xxx, yyy)
,如果能找到,则表明 xxx 算子的别名是 yyy,后续搜索流程则使用 yyy 来搜索,以elementwise_add
为例,别名是add
,如果没有,则表示其没有别名。2. 配置算子映射
首先打开
paddle/phi/api/yaml/op_compat.yaml
,全文搜索op : yyy
,看看能否找到,如果不能,那么先插入:如果没有别名,则直接
- op : xxx
即可。3. 判断算子动态参数
接下来,你需要判断这个算子的动态参数名,首先打开
paddle/phi/api/yaml/legacy_ops.yaml
(和paddle/phi/api/yaml/legacy_backward.yaml
),全文搜索- op : yyy
。比如
可以看到参数为
x, y
,输出为out
,其余内容可以先忽略。4. 判断算子静态参数
寻找
xxx_op.cc
文件,如果找不到,则查找REGISTER_OPERATOR(xxx)
的出现文件,随后你就可以通过里面的OpMaker
判断。如
可以看到其中 x、y 是对应大写等等。
5. 基于动静参数配置映射
参考前面得到的参数,如果两者不同,则配置不同部分如下:
6. 配置输出参数、特殊参数等等
根据具体情况而定,不特殊说明,流程基本如上。