提交 97df75b2 编写于 作者: L Liu Yiqun

Add comments for CHECK of size.

上级 6554854a
...@@ -38,7 +38,7 @@ class TensorLite; ...@@ -38,7 +38,7 @@ class TensorLite;
using DDim = lite::DDimLite; using DDim = lite::DDimLite;
using Tensor = lite::TensorLite; using Tensor = lite::TensorLite;
template <typename ValueType, int DimLength> template <typename ValueType, size_t DimLength>
class DimVector { class DimVector {
public: public:
DimVector() { DimVector() {
...@@ -48,7 +48,9 @@ class DimVector { ...@@ -48,7 +48,9 @@ class DimVector {
size_t size() const { return size_; } size_t size() const { return size_; }
void resize(size_t new_size) { void resize(size_t new_size) {
CHECK_LE(new_size, DimLength); CHECK_LE(new_size, DimLength)
<< "Expected the number of dimentations <= " << DimLength
<< ", received " << new_size << ".";
size_ = new_size; size_ = new_size;
} }
...@@ -63,10 +65,10 @@ class DimVector { ...@@ -63,10 +65,10 @@ class DimVector {
size_t size_{0}; size_t size_{0};
}; };
constexpr int kMaxDimLength = 10;
class DDimLite { class DDimLite {
public: public:
constexpr static size_t kMaxDimLength = 10;
using value_type = int64_t; using value_type = int64_t;
using DDimVector = DimVector<value_type, kMaxDimLength>; using DDimVector = DimVector<value_type, kMaxDimLength>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册