-
Couldn't load subscription status.
- Fork 5.9k
[Dynamic] Check whether there is any inplace operation affecting gradient calculation #27901
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
Conversation
|
Thanks for your contribution! |
a8b1295 to
9d143f7
Compare
9d143f7 to
8fbcbc0
Compare
2cade8c to
72f57e9
Compare
c0ce39a to
acbf749
Compare
acbf749 to
0fdf109
Compare
0fdf109 to
e93b6b4
Compare
815f59c to
3b4be7e
Compare
33ee39c to
7a1f389
Compare
7a1f389 to
55122db
Compare
9ef3519 to
07cf9aa
Compare
Change-Id: I7832f3546b638de06fa991be3058571147f65ddc Add bump_version and deal with api assign Add doc for version and bump_version
…cation or Variable. fix bug: Only supports Tensor, LoDTensor, SelectedRows and LoDTensorArray to have TensorInplaceVersion. If the inplace_version is not changed, use original var_wrapper
af9ca11 to
4447049
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.
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 tensor.h! 注释写的太太太棒了!
623346f to
5e7f67a
Compare
…rformane. Put LoDTensor in the first to optimize speed.
5e7f67a to
6900046
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.
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
PR types
New features
PR changes
Others
Describe
The next PR of #27471
Deal with the backward to support assignment to a Variable in dynamic mode.
What this PR do ?
1. Add a new attribute
versionforVarBaseversionis used to check whether an inplace operation will result in an incorrect gradient calculation.The version number is incremented whenever the current VarBase is modified through an inplace operation.
2. Raise error if an inplace operation can result in incorrect gradient computation.
For example:
Example for i
Example for ii
3. Add a new interface
_bump_inplace_version()forVarBaseto bump the version whenever the Tensor is modified through an inplace operation.4. For api
assign, call_bump_inplace_version()when it's an inplace operation inn dynamic modeSpeed comparison
seq2seq :
batch num: 20*100
batch size: 32
resnet:
batch num: 10*100
batch size: 2
ptb:
batch num: 200*100
batch size:100