diff --git a/mindspore/core/ir/dtype/tensor_type.cc b/mindspore/core/ir/dtype/tensor_type.cc index 31df37ebc2..4c1cd5b5dc 100644 --- a/mindspore/core/ir/dtype/tensor_type.cc +++ b/mindspore/core/ir/dtype/tensor_type.cc @@ -64,7 +64,9 @@ bool UndeterminedType::operator==(const Type &other) const { } TypePtr TensorType::DeepCopy() const { - MS_EXCEPTION_IF_NULL(element_type_); + if (element_type_ == nullptr) { + return std::make_shared(); + } if (IsGeneric()) { return std::make_shared(); } diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index 96384eafd2..6517a912ce 100644 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -347,7 +347,8 @@ class IsInstance(PrimitiveWithInfer): sub_type_t = inst['dtype'] type_v = type_['value'] - validator.check_const_input("inst", inst['value'], self.name) + if not isinstance(inst, type(mstype.tensor)): + validator.check_const_input("inst", inst['value'], self.name) validator.check_value_type("type_", type_v, [mstype.Type], self.name) if type_v == mstype.list_: