forked from mindspore-Ecosystem/mindspore
!40640 Fix robin_hood::map overflow
Merge pull request !40640 from hewei/fix_master
This commit is contained in:
commit
e4fc85c3ea
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue