Skip to content

Commit

Permalink
fix shape index bug (apache#14630)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-haibin-lin authored and reminisce committed Apr 5, 2019
1 parent a64e299 commit 46affc1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 46affc1

Please sign in to comment.