Skip to content

Commit f62f518

Browse files
committed
Use explicit type for std::transform.
* Also fix a protential bug in WarpCTCLayer.cpp
1 parent d5c0eed commit f62f518

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

paddle/gserver/layers/WarpCTCLayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ bool WarpCTCLayer::init(const LayerMap& layerMap,
3131
CHECK_EQ(numClasses_, inputLayers_[0]->getSize());
3232

3333
blank_ = config_.blank();
34-
CHECK_GE(blank_, 0UL);
3534
CHECK_LT(blank_, numClasses_);
3635

3736
normByTimes_ = config_.norm_by_times();

paddle/pserver/ParameterClient2.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,7 @@ void PreparedOperations::addOperationHelper(Operation* op, CpuMatrixPtr mat) {
611611
pmat.mutable_values(), mat->getData(), pmat.num_cols() * pmat.num_rows());
612612
}
613613

614-
template <typename T1, typename T2>
615-
static inline auto add(T1 a, T2 b) -> decltype(a + b) {
616-
return a + b;
617-
}
614+
static inline real addTwo(real a, double b) { return a + b; }
618615

619616
void ParameterClient2::doOperation(PreparedOperations& ops,
620617
bool waitForGradient,
@@ -684,7 +681,7 @@ void ParameterClient2::doOperation(PreparedOperations& ops,
684681
rvec->getData() + rvec->getSize(),
685682
vec.values().data(),
686683
rvec->getData(),
687-
add<real, double>);
684+
addTwo);
688685
}
689686

690687
CHECK_EQ(resultMatrices.size(), (size_t)result.matrices_size());
@@ -699,7 +696,7 @@ void ParameterClient2::doOperation(PreparedOperations& ops,
699696
rmat->getData() + rmat->getElementCnt(),
700697
mat.values().data(),
701698
rmat->getData(),
702-
add<real, double>);
699+
addTwo);
703700
}
704701
}
705702
}

0 commit comments

Comments
 (0)