diff --git a/paddle/optimizer/Tensor.h b/paddle/optimizer/Tensor.h index fbfba4806a1c9dba2376ca81950974193f698059..41afacd75659f71d98eedab0cd69d0f66b50a27c 100644 --- a/paddle/optimizer/Tensor.h +++ b/paddle/optimizer/Tensor.h @@ -23,11 +23,11 @@ public: this->data_ = t.get_buffer(); } T* get_buffer() { return this->data_; } - T& operator[](const int idx) { + T& operator[](const size_t idx) { CHECK(idx >= 0 && idx < this->width_) << "out of index range"; return data_[idx]; } - T& operator[](const int idx) const { + T& operator[](const size_t idx) const { CHECK(idx >= 0 && idx < this->width_) << "out of index range"; return data_[idx]; }