-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add a C++ program that prints operator document in JSON format #4981
Conversation
paddle/pybind/print_operators_doc.cc
Outdated
int main() { | ||
std::cout << "[\n"; | ||
for (auto iter : paddle::framework::OpInfoMap::Instance().map()) { | ||
PrintOpProto(iter.first, iter.second); |
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.
I think it might have an extra comma at the end of list.
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.
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.
paddle/pybind/print_operators_doc.cc
Outdated
|
||
int main() { | ||
std::cout << "[\n"; | ||
for (auto iter : paddle::framework::OpInfoMap::Instance().map()) { |
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.
for (auto& iter : ...)
Use reference to reduce copy.
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.
Thanks! Done.
paddle/pybind/pybind.cc
Outdated
"Serialize OpProto Error. This could be a bug of Paddle."); | ||
ret_values.emplace_back(str); | ||
}); | ||
for (auto iter : OpInfoMap::Instance().map()) { |
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.
auto& iter
Use reference to reduce copy
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.
Done
paddle/pybind/pybind.cc
Outdated
}); | ||
for (auto iter : OpInfoMap::Instance().map()) { | ||
auto type = iter.first; | ||
auto info = iter.second; |
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.
auto& info
Use reference to reduce copy
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.
Done
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.
Fixes #4901