Skip to content

Commit 7946a69

Browse files
Bugfix
1 parent 0f71774 commit 7946a69

1 file changed

Lines changed: 17 additions & 18 deletions

File tree

accelforge/mapper/FFM/_make_pmappings/make_pmappings_from_templates/make_tile_shapes.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,9 +1083,6 @@ def grab_symbol(prev_symbol: Symbol = None):
10831083
f"BUG: symbol {symbol} is neither stride nor initial tile shape"
10841084
)
10851085

1086-
# if not partitions:
1087-
# return np.array([]).reshape(-1, len(symbols))
1088-
10891086
prev_size = choices_enumerated.shape[0] if choices_enumerated is not None else 1
10901087
choices_enumerated = np.concatenate(choices, axis=0)
10911088
job.n_total_pmappings *= choices_enumerated.shape[0] / max(1, prev_size)
@@ -1223,10 +1220,26 @@ def update_symbol2goal(
12231220
except (TypeError, ValueError):
12241221
pass
12251222

1223+
porp = sum(valid) / max(1, choices_enumerated.shape[0])
1224+
job.log_porp_pmappings_kept(
1225+
f"{objective.name}",
1226+
sum(valid) / max(1, prev_size),
1227+
)
1228+
log_message(f"Valid check", f"{objective.name}", f"porp={porp:.2%}")
1229+
if complete:
1230+
objective.max_value = None # We don't care anymore
1231+
objective.min_value = None
1232+
if objective.only_care_if_valid:
1233+
objectives.remove(objective)
1234+
log_message(f"Removed {objective.name} because it is always valid")
1235+
1236+
if not choices_enumerated.shape[0]:
1237+
return np.array([]).reshape(-1, len(symbols))
1238+
12261239
if choices_enumerated.shape[0] < 1000:
12271240
continue
12281241

1229-
for objective in list(objectives):
1242+
for objective in objectives:
12301243
# ==========================================================================
12311244
# If there's a max value, then check for validity
12321245
# ==========================================================================
@@ -1241,20 +1254,6 @@ def update_symbol2goal(
12411254
objective.formula, sym_enumerated_set, what_tiles_symbol.bounds
12421255
)
12431256

1244-
porp = sum(valid) / max(1, choices_enumerated.shape[0])
1245-
job.log_porp_pmappings_kept(
1246-
f"{objective.name}",
1247-
sum(valid) / max(1, prev_size),
1248-
)
1249-
log_message(f"Valid check", f"{objective.name}", f"porp={porp:.2%}")
1250-
if complete:
1251-
objective.max_value = None # We don't care anymore
1252-
objective.min_value = None
1253-
if objective.only_care_if_valid:
1254-
objectives.remove(objective)
1255-
log_message(f"Removed {objective.name} because it is always valid")
1256-
goals.clear()
1257-
12581257
log_message(f"formula", f"{objective.formula}")
12591258
for k, v in goals.items():
12601259
log_message("formula", f"\t -> {k}: {v}")

0 commit comments

Comments
 (0)