Skip to content

Commit

Permalink
[MetaSchedule][Minor] Fix Median Number (#12273)
Browse files Browse the repository at this point in the history
The previous median number calculation util function used the wrong index which could cause out of bound issue as mentioned in #12199 . This PR fixed this issue.
  • Loading branch information
zxybazh committed Aug 2, 2022
1 parent bc91978 commit 0261b8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/meta_schedule/utils.h
Expand Up @@ -357,7 +357,7 @@ inline double GetRunMsMedian(const RunnerResult& runner_result) {
std::sort(v.begin(), v.end());
int n = v.size();
if (n % 2 == 0) {
return (v[n / 2] + v[n / 2 + 1]) * 0.5 * 1000.0;
return (v[n / 2 - 1] + v[n / 2]) * 0.5 * 1000.0;
} else {
return v[n / 2] * 1000.0;
}
Expand Down

0 comments on commit 0261b8e

Please sign in to comment.