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

Remove m4 when generate protobuf #846

Merged
merged 2 commits into from
Dec 13, 2016

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Dec 13, 2016

Remove m4 macro language in protobuf generation. Always use double when serializing in protobuf, but use float or double in Paddle C++.

Because of the implicit conversion between float and double, most of C++ code do not need to change.

Also fix compile issues
Copy link
Contributor

@hedaoyuan hedaoyuan left a comment

Choose a reason for hiding this comment

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

LGTM,也许float就可以。

@@ -618,6 +611,11 @@ void PreparedOperations::addOperationHelper(Operation* op, CpuMatrixPtr mat) {
pmat.mutable_values(), mat->getData(), pmat.num_cols() * pmat.num_rows());
}

template <typename T1, typename T2>
static inline auto add(T1 a, T2 b) -> decltype(a + b) {
Copy link
Contributor

Choose a reason for hiding this comment

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

return 类型不是T1?decltype的话不对吧。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

不是T1。也有可能是T2吧。。这个decltype反正可以返回a+b应该的类型。

Copy link
Contributor

Choose a reason for hiding this comment

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

你这里是确定的吧,结果最终存储的数据类型是T1指定的类型。

@reyoung
Copy link
Collaborator Author

reyoung commented Dec 13, 2016 via email

* Also fix a protential bug in WarpCTCLayer.cpp
@@ -31,7 +31,6 @@ bool WarpCTCLayer::init(const LayerMap& layerMap,
CHECK_EQ(numClasses_, inputLayers_[0]->getSize());

blank_ = config_.blank();
CHECK_GE(blank_, 0UL);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个check是没有必要,并且永远为真的。

因为blank_是size_t,也是unsigned int。永远大于0。

Copy link
Contributor

Choose a reason for hiding this comment

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

ok.

@reyoung reyoung merged commit f8e8d1a into PaddlePaddle:develop Dec 13, 2016
@reyoung reyoung mentioned this pull request Dec 14, 2016
14 tasks
@reyoung reyoung deleted the feature/remove_m4 branch December 14, 2016 09:49
wangxicoding pushed a commit to wangxicoding/Paddle that referenced this pull request Dec 9, 2021
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