-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
Also fix compile issues
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,也许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) { |
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.
return 类型不是T1?decltype的话不对吧。
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.
不是T1。也有可能是T2吧。。这个decltype反正可以返回a+b应该的类型。
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.
你这里是确定的吧,结果最终存储的数据类型是T1指定的类型。
哦。。对。。有道理。。我改成不用模版的吧
发自 Smartisan T2
hedaoyuan <notifications@github.com> 于 2016年12月13日,上午11:29写道:
@hedaoyuan commented on this pull request.
________________________________
In paddle/pserver/ParameterClient2.cpp<#846>:
@@ -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) {
你这里是确定的吧,结果最终存储的数据类型是T1指定的类型。
―
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#846>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAsee7MVpD2nje6iLXhcuhxE3RS2Z733ks5rHhEUgaJpZM4LLRYt>.
|
* 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); |
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.
这个check是没有必要,并且永远为真的。
因为blank_是size_t,也是unsigned int。永远大于0。
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.
ok.
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
anddouble
, most of C++ code do not need to change.