File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
python/tvm/meta_schedule/cost_model Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -537,13 +537,17 @@ def _mean_cost(x: RunnerResult) -> float:
537
537
self .last_train_size = self .data_size
538
538
539
539
# Step 5. Re-train the model
540
- self ._train (
541
- xs = list (itertools_chain .from_iterable ([g .features for g in self .data .values ()])),
542
- ys = np .concatenate (
543
- [g .min_cost / g .costs for g in self .data .values ()],
544
- axis = 0 ,
545
- ),
546
- )
540
+ with np .errstate (divide = "ignore" , invalid = "ignore" ):
541
+ feature_list = list (
542
+ itertools_chain .from_iterable ([g .features for g in self .data .values ()])
543
+ )
544
+ cost_ratio_list = [
545
+ np .divide (g .min_cost , g .costs , out = np .zeros_like (g .costs ), where = g .costs != 0 )
546
+ for g in self .data .values ()
547
+ ]
548
+ cost_ratios = np .concatenate (cost_ratio_list , axis = 0 )
549
+
550
+ self ._train (xs = feature_list , ys = cost_ratios )
547
551
548
552
def predict (
549
553
self ,
You can’t perform that action at this time.
0 commit comments