-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[GLCC]Part-1: Add pylayer op to Support @to_static #56108
[GLCC]Part-1: Add pylayer op to Support @to_static #56108
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
b8c2e37
to
1567e93
Compare
1567e93
to
fabfa33
Compare
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.
Nice work!
paddle/fluid/operators/controlflow/conditional_block_op_helper.cc
Outdated
Show resolved
Hide resolved
paddle/fluid/operators/controlflow/conditional_block_op_helper.h
Outdated
Show resolved
Hide resolved
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.
reply
|
||
#include "paddle/fluid/operators/controlflow/static_pylayer_op.h" | ||
|
||
#include "paddle/fluid/framework/new_executor/standalone_executor.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.
有道理。目前只需要依赖 interpretercore.h
paddle/fluid/operators/controlflow/conditional_block_op_helper.cc
Outdated
Show resolved
Hide resolved
paddle/fluid/operators/controlflow/conditional_block_op_helper.h
Outdated
Show resolved
Hide resolved
#include <vector> | ||
|
||
#include "paddle/fluid/framework/executor.h" | ||
#include "paddle/fluid/framework/new_executor/standalone_executor.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.
确实这两个头文件依赖不是必须的,后续将移除
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.
LGTM overall
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.
LGTM for fluid change
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.
LGTM
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.
LGTM for docs
Returns: | ||
Variable|list(Variable)|tuple(Variable): returns the output of ``forward_fn(inputs)`` | ||
|
||
Examples: |
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.
代码示例的写法,正逐步改成google style样式,参考 PaddlePaddle/docs#6096 ,
之后若有涉及到写代码示例,请采用新的写法。
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.
好的了解了,这个之后的 pr 还会继续修改该 api,会在之后的 pr 中修改成 google style 样式
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.
@MarioLulab 嗷对了,请同步补充一下中文文档,在 docs repo下。
另外.. code-block:: python
是两个冒号,下个pr同步修改下吧~
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.
好的了解了,下个 pr 完善这个 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.
一般OpMaker和Op类都放在.cc文件中,这个头文件目前看上去也没有专门使用的需要,是否可以去掉?
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.
好的了解了,之后的 pr 还会继续修改该 api 和 算子,会在之后的 pr 中将 OpMaker 放在 .cc 文件中
PR types
New features
PR changes
Others
Description
Original requirements
It is expected that the PyLayer mechanism in the dynamic graph of the Paddle can interoperate with the @to_static of the Paddle's dynamic to static, supporting the custom layer of the PyLayer in the model to be perceived by the @to_static and correctly generating the static graph Program, and supporting the training of the dynamic to static and the exporting for inference.
So our main objective is to Enable PyLayer to Support @to_static. In this PR, we do some fundamental work for our objective, adding an operator called
pylayer
.Related issues
【Feature Request】 PyLayer 功能支持动转静 @to_static 🚀: #54120
Project Records
https://github.com/MarioLulab/GLCC2023-Paddle-Record
Main works
pylayer
which can excute block user-defined block when forward and backward.pylayer
oppylayer
op, which help users usepylayer
op easily.TO-DO works:
@to_static
to sense and handle the computational logic in theforward()
andbackward()
functions in dynamic PyLayer.@to_static
withpylayer
op to achive the goal.