-
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
add inplace attribute to op_proto_maker #10665
add inplace attribute to op_proto_maker #10665
Conversation
dzhwinter
commented
May 15, 2018
•
edited by sneaxiy
Loading
edited by sneaxiy
- add reused attribute to OpProto.
- change the related operator to use inplace attribute.
@@ -115,7 +115,7 @@ class SumOpMaker : public framework::OpProtoAndCheckerMaker { | |||
void Make() override { | |||
AddInput("X", "(vector<Tensor>) The input tensors of sum operator.") | |||
.AsDuplicable(); | |||
AddOutput("Out", "(Tensor) The output tensor of sum operator."); | |||
AddOutput("Out", "(Tensor) The output tensor of sum operator.").Reuse("X"); |
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.
In this case, Out should reuse the first Tensor memory of X(vector ), but we didn't have the sub-variable name of X.
The test only covers OpMaker, please add a runtime test for this feature. |
there are already a bunch of |
Have discussed this issue with @tonyyang-svail , we will move the in-place attribute into the ssa-graph framework. This PR is add an inplace attribute for every Operator in Python-side. |
AddOutput("Moment2Out", "(Tensor) Output second moment"); | ||
AddOutput("ParamOut", "(Tensor) Output parameter").Reuse("Param"); | ||
AddOutput("Moment1Out", "(Tensor) Output first moment").Reuse("Moment1"); | ||
AddOutput("Moment2Out", "(Tensor) Output second moment").Reuse("Moment2"); |
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.
Is Moment2Out
forced share memory with Moment2
?
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.
It's not forced, is a suggestion will be get in memory optimizer in Python.