From 7568b541941fb578822608fd6294fdc8b1956028 Mon Sep 17 00:00:00 2001 From: Haibin Lin Date: Fri, 5 Apr 2019 10:30:20 -0700 Subject: [PATCH] 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 69468f33ed07..94fc6dde6f0b 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];