From 48e94a1c5ba9911e79a653a9eea7c72704091cd7 Mon Sep 17 00:00:00 2001 From: caifubi Date: Sat, 14 Nov 2020 14:31:15 +0800 Subject: [PATCH] fix unique infershape bug with data type int64 --- mindspore/core/abstract/prim_arrays.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mindspore/core/abstract/prim_arrays.cc b/mindspore/core/abstract/prim_arrays.cc index c08f59fad2..8ddf36ac75 100644 --- a/mindspore/core/abstract/prim_arrays.cc +++ b/mindspore/core/abstract/prim_arrays.cc @@ -170,7 +170,9 @@ AbstractBasePtr InferImplUnique(const AnalysisEnginePtr &, const PrimitivePtr &p std::make_shared(input->element(), std::make_shared(ids_shape, min_shape, max_shape)); // Currently we choose the same data type as input for the idx. TypePtr ids_idx_type = kInt32; - if (input->element() != nullptr && input->element()->GetTypeTrack() == kInt64) { + MS_EXCEPTION_IF_NULL(input->element()); + MS_EXCEPTION_IF_NULL(input->element()->GetTypeTrack()); + if (input->element()->GetTypeTrack()->type_id() == TypeId::kNumberTypeInt64) { ids_idx_type = kInt64; } auto ids_idx = std::make_shared(ids_idx_type, shape->shape());