Skip to content
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

Merged
merged 12 commits into from
Jun 11, 2018

Conversation

dzhwinter
Copy link
Contributor

@dzhwinter dzhwinter commented May 15, 2018

  • 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");
Copy link
Contributor Author

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.

@dzhwinter dzhwinter changed the title Feature/inplace attr add inplace attribute to op_proto_maker May 17, 2018
@tonyyang-svail
Copy link

The test only covers OpMaker, please add a runtime test for this feature.

@tonyyang-svail
Copy link

there are already a bunch of in_place field on the python side. Not sure how to make them work together...

@dzhwinter
Copy link
Contributor Author

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");
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@dzhwinter dzhwinter merged commit bfa3fd6 into PaddlePaddle:develop Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants