This is an automated email from the ASF dual-hosted git repository.
reminisce pushed a commit to branch numpy
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/numpy by this push:
new 16f35f9 fix shape index bug (#14630)
16f35f9 is described below
commit 16f35f9e0d25566b2d18ba2e1ecb8a8c4334086d
Author: Haibin Lin <[email protected]>
AuthorDate: Fri Apr 5 10:30:20 2019 -0700
fix shape index bug (#14630)
---
src/c_api/c_api.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/c_api/c_api.cc b/src/c_api/c_api.cc
index 69468f3..94fc6dd 100644
--- a/src/c_api/c_api.cc
+++ b/src/c_api/c_api.cc
@@ -802,7 +802,7 @@ int MXDataIterGetLabel(DataIterHandle handle, NDArrayHandle
*out) {
// temp hack to make label 1D
// TODO(tianjun) make label 1D when label_width=0
mxnet::TShape shape = db.data[1].shape();
- if (shape[1] == 1) {
+ if (shape.ndim() > 1 && shape[1] == 1) {
*pndarray = db.data[1].Reshape(mshadow::Shape1(shape[0]));
} else {
*pndarray = db.data[1];