From f62f5181f1193a7bd425e1a9fd67927a22a7e722 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Tue, 13 Dec 2016 14:56:22 +0800 Subject: [PATCH] Use explicit type for std::transform. * Also fix a protential bug in WarpCTCLayer.cpp --- paddle/gserver/layers/WarpCTCLayer.cpp | 1 - paddle/pserver/ParameterClient2.cpp | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/paddle/gserver/layers/WarpCTCLayer.cpp b/paddle/gserver/layers/WarpCTCLayer.cpp index 23ca5257b6d..94e926a8d8f 100644 --- a/paddle/gserver/layers/WarpCTCLayer.cpp +++ b/paddle/gserver/layers/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); CHECK_LT(blank_, numClasses_); normByTimes_ = config_.norm_by_times(); diff --git a/paddle/pserver/ParameterClient2.cpp b/paddle/pserver/ParameterClient2.cpp index 887168075e3..86fd1c5276c 100644 --- a/paddle/pserver/ParameterClient2.cpp +++ b/paddle/pserver/ParameterClient2.cpp @@ -611,10 +611,7 @@ void PreparedOperations::addOperationHelper(Operation* op, CpuMatrixPtr mat) { pmat.mutable_values(), mat->getData(), pmat.num_cols() * pmat.num_rows()); } -template -static inline auto add(T1 a, T2 b) -> decltype(a + b) { - return a + b; -} +static inline real addTwo(real a, double b) { return a + b; } void ParameterClient2::doOperation(PreparedOperations& ops, bool waitForGradient, @@ -684,7 +681,7 @@ void ParameterClient2::doOperation(PreparedOperations& ops, rvec->getData() + rvec->getSize(), vec.values().data(), rvec->getData(), - add); + addTwo); } CHECK_EQ(resultMatrices.size(), (size_t)result.matrices_size()); @@ -699,7 +696,7 @@ void ParameterClient2::doOperation(PreparedOperations& ops, rmat->getData() + rmat->getElementCnt(), mat.values().data(), rmat->getData(), - add); + addTwo); } } } -- GitLab