Skip to content

Commit

Permalink
Fix the index check in ndarray. (apache#4398)
Browse files Browse the repository at this point in the history
N-length array should only have index from 0 to N-1.
  • Loading branch information
howard0su authored and piiswrong committed Dec 29, 2016
1 parent 835d690 commit 6f95b74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/mxnet/ndarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class NDArray {
inline NDArray At(index_t idx) const {
NDArray ret = *this;
CHECK(!is_none()) << "NDArray is not initialized";
CHECK_GE(shape_[0], idx) << "index out of range";
CHECK_GT(shape_[0], idx) << "index out of range";
size_t length = shape_.ProdShape(1, shape_.ndim());
ret.offset_ += idx * length;
if (shape_.ndim() > 1) {
Expand Down

0 comments on commit 6f95b74

Please sign in to comment.