From df62df7e6726b502d34ed5805ba26f44b7cfdd92 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Sat, 14 Jan 2017 16:30:24 +0800 Subject: [PATCH] Partially follow comments --- paddle/math/RowBuffer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/math/RowBuffer.h b/paddle/math/RowBuffer.h index bb55ca5f9f0..0edcefd7562 100644 --- a/paddle/math/RowBuffer.h +++ b/paddle/math/RowBuffer.h @@ -47,7 +47,7 @@ public: */ inline void resize(int rowCnt) { if (preallocatedBuf_) { - CHECK(preallocatedBuf_->getSize() < rowCnt * width_ * sizeof(real)); + CHECK(preallocatedBuf_->getSize() >= rowCnt * width_ * sizeof(real)); } else { rowStore_.resize(rowCnt * width_); } @@ -107,7 +107,7 @@ public: */ inline size_t getRowCount() const { if (preallocatedBuf_) { - return preallocatedBuf_->getSize() / sizeof(float) / width_; + return preallocatedBuf_->getSize() / sizeof(real) / width_; } else { return rowStore_.size() / width_; } @@ -117,7 +117,7 @@ public: * @brief get is this buffer can automatically grow or not. * @return ture if can automacitally grow. */ - inline bool isAutoGrowth() const { return preallocatedBuf_ == nullptr; } + inline bool isAutoGrowth() const { return !preallocatedBuf_; } /** * @brief return the width of matrix. a.k.a length of row. -- GitLab