From b3fb616bfe5d8099629bb313350c589e04d6508f Mon Sep 17 00:00:00 2001 From: chenfei Date: Thu, 12 May 2022 14:27:27 +0800 Subject: [PATCH] fix perfomance --- mindspore/core/abstract/abstract_value.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mindspore/core/abstract/abstract_value.cc b/mindspore/core/abstract/abstract_value.cc index b8dd4c02756..17f70b7524a 100644 --- a/mindspore/core/abstract/abstract_value.cc +++ b/mindspore/core/abstract/abstract_value.cc @@ -1174,7 +1174,8 @@ bool AbstractRef::operator==(const AbstractRef &other) const { return true; } // Check whether the ref_key_value is equal. - if (!IsEqual(ref_key_value_, other.ref_key_value_)) { + if (ref_key_value_ != kAnyValue && other.ref_key_value_ != kAnyValue && + !IsEqual(ref_key_value_, other.ref_key_value_)) { return false; } // Check whether Tensor value is equal. @@ -1224,7 +1225,7 @@ AbstractBasePtr AbstractRef::Broaden() const { // always broaden for ref auto abs_tensor = AbstractTensor::Broaden()->cast(); // Broaden the tensor value and keep the ref_key_value. - auto ret = std::make_shared(abs_tensor, ref_key_value_); + auto ret = std::make_shared(abs_tensor, kAnyValue); return ret; }