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 a C++ program that prints operator document in JSON format #4981

Merged
merged 10 commits into from
Oct 23, 2017

Conversation

wangkuiyi
Copy link
Collaborator

Fixes #4901

int main() {
std::cout << "[\n";
for (auto iter : paddle::framework::OpInfoMap::Instance().map()) {
PrintOpProto(iter.first, iter.second);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it might have an extra comma at the end of list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right -- Thank you for the very careful review. It is just that I don't have a good idea not to print it.


int main() {
std::cout << "[\n";
for (auto iter : paddle::framework::OpInfoMap::Instance().map()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

for (auto& iter : ...)

Use reference to reduce copy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! Done.

"Serialize OpProto Error. This could be a bug of Paddle.");
ret_values.emplace_back(str);
});
for (auto iter : OpInfoMap::Instance().map()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

auto& iter

Use reference to reduce copy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

});
for (auto iter : OpInfoMap::Instance().map()) {
auto type = iter.first;
auto info = iter.second;
Copy link
Collaborator

Choose a reason for hiding this comment

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

auto& info

Use reference to reduce copy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@reyoung reyoung left a comment

Choose a reason for hiding this comment

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

LGTM.

@wangkuiyi wangkuiyi merged commit cdb5f29 into PaddlePaddle:develop Oct 23, 2017
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.

3 participants