diff --git a/mindspore/core/abstract/abstract_value.cc b/mindspore/core/abstract/abstract_value.cc index 9fd2e2de090..2b4cfd8dd1c 100644 --- a/mindspore/core/abstract/abstract_value.cc +++ b/mindspore/core/abstract/abstract_value.cc @@ -1378,20 +1378,9 @@ ValuePtr AbstractKeywordArg::RealBuildValue() const { } std::size_t AbstractBasePtrListHash(const AbstractBasePtrList &args_spec_list) { - // Hash for empty list is zero. - if (args_spec_list.empty()) { - return 0; - } - // Hashing all elements is costly, we only calculate hash from - // the first element and last few elements base on some experiments. - constexpr size_t kMaxLastElements = 4; - const size_t n_args = args_spec_list.size(); - // Hash from list size and the first element. - std::size_t hash_value = hash_combine(n_args, args_spec_list[0]->hash()); - // Hash from last few elements. - const size_t start = ((n_args > kMaxLastElements) ? (n_args - kMaxLastElements) : 1); - for (size_t i = start; i < n_args; ++i) { - hash_value = hash_combine(hash_value, args_spec_list[i]->hash()); + std::size_t hash_value = args_spec_list.size(); + for (const auto &arg : args_spec_list) { + hash_value = hash_combine(hash_value, (arg == nullptr ? 0 : arg->hash())); } return hash_value; } diff --git a/tests/st/model_zoo_tests/transformer/test_transformer.py b/tests/st/model_zoo_tests/transformer/test_transformer.py index 032367d15ac..34a2a34ce23 100644 --- a/tests/st/model_zoo_tests/transformer/test_transformer.py +++ b/tests/st/model_zoo_tests/transformer/test_transformer.py @@ -217,7 +217,7 @@ def test_transformer(): assert per_step_mseconds <= expect_per_step_mseconds + 10 -@pytest.mark.level1 +@pytest.mark.level0 @pytest.mark.platform_arm_ascend_training @pytest.mark.platform_x86_ascend_training @pytest.mark.env_onecard