diff --git a/src/meta_schedule/task_scheduler/task_scheduler.cc b/src/meta_schedule/task_scheduler/task_scheduler.cc index d7b93b9be2252..cd287fc1d4985 100644 --- a/src/meta_schedule/task_scheduler/task_scheduler.cc +++ b/src/meta_schedule/task_scheduler/task_scheduler.cc @@ -128,18 +128,7 @@ void TaskSchedulerNode::Tune() { ICHECK(!task->is_terminated); ICHECK(!task->runner_futures.defined()); SearchStrategy strategy = task->search_strategy.value(); - Optional> candidates = strategy->GenerateMeasureCandidates(); - if (candidates.defined()) { - // Filter out invalid candidates. - // An invalid candidate can arise due to a schdule application failure (e.g. tensorize). - Array valid_candidates; - for (MeasureCandidate candidate : candidates.value()) { - if (candidate.defined()) { - valid_candidates.push_back(candidate); - } - } - - task->measure_candidates = std::move(valid_candidates); + if ((task->measure_candidates = strategy->GenerateMeasureCandidates()).defined()) { num_trials_already += task->measure_candidates.value().size(); SendToBuilder(this->builder, task); SendToRunner(this->runner, task);