From d32b509a5afb80e25bdbe7f189334e7a02cc7d35 Mon Sep 17 00:00:00 2001 From: Tatsuya Nishiyama Date: Sat, 21 Jul 2018 00:54:47 +0900 Subject: [PATCH] Fix GetReduceAces (#1460) --- nnvm/src/top/tensor/reduce.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnvm/src/top/tensor/reduce.cc b/nnvm/src/top/tensor/reduce.cc index afe9475f5cbb..cb6848e1be7f 100644 --- a/nnvm/src/top/tensor/reduce.cc +++ b/nnvm/src/top/tensor/reduce.cc @@ -48,7 +48,7 @@ inline TShape GetReduceAxes(const uint32_t indim, if (!exclude) return in_axis; TShape r_axis(indim - in_axis.ndim()); for (unsigned i = 0, j = 0, k = 0; i < indim; ++i) { - if (i == in_axis[j]) { + if (j < in_axis.ndim() && i == in_axis[j]) { ++j; continue; }