-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Propose a typedefs header for paddle framework #2584
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
Propose a typedefs header for paddle framework #2584
Conversation
The original discuess in * PaddlePaddle#2548 (comment) * PaddlePaddle#2579 (comment) This commit is just a proposal, let's do such kind of summarization in this PR.
|
I just run grep std (find . -name '*.h' -o -name '*.cpp') | sed -r 's#.*std\:\:([a-z_0-9]+)[<(\ ].*#\1#g' | grep -v 'std::' | sort | uniq -c | sort -r | head -n 10in current PaddlePaddle repo. It returns Maybe we should typedef:
And there are some classes in
|
| } | ||
|
|
||
| //! MakeUnique will create std::unique_ptr | ||
| template <typename T, typename... ARGS> |
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 did not distinguish special case, for instance, is_array<T>::value
For that case, you need to using U = typename remove_extent<T>::type;
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 a_uptr = make_unique<int[]>(10);
| //! Using unordered_map as Paddle's default map. It will faster than | ||
| //! std::map | ||
| template <typename Key, typename Val> | ||
| using Map = std::unordered_map<Key, Val>; |
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.
How about UMap or uMap?
I'm afraid most people will assume Map to be the alias of std::map at first sight.
wangkuiyi
left a comment
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 using std::vector saves readers the time to grep and find out what Vector is.
Also, I don't think we will always use std::map or std::unordered_map over another one. Instead, in some curcumstances we need std::map and in some others we need std::unordered_map. It doesn't make much sense to me to stick on either of them and give the stick a name like Map.
The original discuess in
This commit is just a proposal, let's do such kind of summarization in
this PR.