-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backward C++ API Code-Generation #39057
Conversation
Thanks for your contribution! |
paddle/pten/api/lib/CMakeLists.txt
Outdated
# backward api file | ||
set(bw_api_gen_file ${CMAKE_SOURCE_DIR}/python/paddle/utils/code_gen/backward_api_gen.py) | ||
set(bw_api_yaml_file ${CMAKE_SOURCE_DIR}/python/paddle/utils/code_gen/backward.yaml) | ||
set(bw_api_header_file ${CMAKE_SOURCE_DIR}/paddle/pten/api/include/backward_api.h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
反向API是不是暂时不要一并暴露给用户
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议不要一并放到api/include目录下,可以新创建一个子目录,比如api/backward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
paddle/pten/api/lib/tensor_adapt.h
Outdated
@@ -0,0 +1,74 @@ | |||
/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
#include "paddle/pten/infermeta/grad_infermeta.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
命名重复了,可以简短一些,grad.h或者backward.h,inferMeta有目录就可以了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,34 @@ | |||
- grad_api : matmul_grad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是上下命名一致好一些,如果文件或目录是backward api的话,里面建议也是backward_api,或者就文件和目录也用grad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, 目前修改为backward_api
@@ -4,7 +4,8 @@ paddle/fluid/API_DEV.spec | |||
paddle/fluid/API_PR.spec | |||
paddle/fluid/op_use_default_grad_maker_DEV.spec | |||
paddle/fluid/op_use_default_grad_maker_PR.spec | |||
paddle/pten/api/*/api* | |||
paddle/pten/api/*/api.* | |||
paddle/pten/api/*/backward* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put specific filenames (api.yaml, backward.yaml) in .gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This will be done in another PR
PR types
New features
PR changes
APIs
Describe
反向C++ API接口自动生成,在#37668的基础上增加了反向C++ API接口。
反向C++ API的自动生成同样采用yaml文件进行配置,配置格式如下(以matmul_grad和scale_grad为例):
注意:当前yaml配置格式非最终形态,后续仍会迭代调整。