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

Enhance print_op. #7517

Merged
merged 1 commit into from
Jan 15, 2018
Merged

Enhance print_op. #7517

merged 1 commit into from
Jan 15, 2018

Conversation

pkuyym
Copy link
Contributor

@pkuyym pkuyym commented Jan 15, 2018

Resolves #7478

Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if (inputs.find("In") != inputs.end() && !Inputs("In").empty()) {
in_var_ptr = scope.FindVar(Input("In"));
printed_var_name = Inputs("In").front();
} else if (inputs.find("In@GRAD") != inputs.end() &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In@GRAD -> some const string variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use the same PrintOp in forward and backward, I just rename the input in GradOpMaker. We can judge whether current phase is forward or backward using the name.
op_desc_ptr->SetInput("In@GRAD", OutputGrad("Out"));

@pkuyym pkuyym merged commit 60eba8b into PaddlePaddle:develop Jan 15, 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.

2 participants