diff --git a/mindspore/core/abstract/prim_arrays.cc b/mindspore/core/abstract/prim_arrays.cc index 4b5aefeac1a..9c72ad800f2 100644 --- a/mindspore/core/abstract/prim_arrays.cc +++ b/mindspore/core/abstract/prim_arrays.cc @@ -140,7 +140,7 @@ AbstractBasePtr InferImplUnique(const AnalysisEnginePtr &, const PrimitivePtr &p auto shape = input->shape(); MS_EXCEPTION_IF_NULL(shape); - if (shape->shape().empty()) { + if (shape->shape().size() != 1) { MS_LOG(EXCEPTION) << "Rank of " << op_name << "'s input must be 1."; } ShapeVector ids_shape = {Shape::SHP_ANY};