Skip to content

Commit 37c01b9

Browse files
committed
better stat
1 parent 0d80c42 commit 37c01b9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

onnx_diagnostic/torch_models/validate.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,14 @@ def _quiet_or_not_quiet(
244244
summary[f"{suffix}_output"] = string_type(res, with_shape=True, with_min_max=True)
245245
summary[f"{suffix}_warmup"] = warmup
246246
summary[f"{suffix}_repeat"] = repeat
247-
for _w in range(max(0, warmup - 1)):
247+
last_ = None
248+
end_w = max(0, warmup - 1)
249+
for _w in range(end_w):
248250
t = fct()
249-
summary[f"io_{suffix}_{_w+1}"] = string_type(t, with_shape=True, with_min_max=True)
251+
_ = string_type(t, with_shape=True, with_min_max=True)
252+
if _ != last_ or _w == end_w - 1:
253+
summary[f"io_{suffix}_{_w+1}"] = _
254+
last_ = _
250255
summary[f"time_{suffix}_warmup"] = time.perf_counter() - begin
251256
times = []
252257
for _r in range(repeat):
@@ -266,7 +271,7 @@ def _quiet_or_not_quiet(
266271
summary[f"time_{suffix}_latency_005"] = a[i5]
267272
summary[f"time_{suffix}_latency_002"] = a[i2]
268273
summary[f"time_{suffix}_n"] = len(a)
269-
summary[f"time_{suffix}_latency_098"] = a[i2:-i2].mean()
274+
summary[f"time_{suffix}_latency_m98"] = a[i2:-i2].mean()
270275

271276
return res
272277

@@ -1725,6 +1730,7 @@ def _simplify(p):
17251730
"check",
17261731
"build_graph_for_pattern",
17271732
"pattern_optimization",
1733+
"topological_sort",
17281734
]:
17291735
if s in p or s.replace("_", "-") in p:
17301736
return s
@@ -2066,7 +2072,7 @@ def _compute_final_statistics(summary: Dict[str, Any]):
20662072
stats["stat_estimated_speedup_ort"] = (
20672073
summary["time_run_latency"] / summary["time_run_onnx_ort_latency"]
20682074
)
2069-
stats["stat_estimated_speedup_ort_098"] = (
2070-
summary["time_run_latency_098"] / summary["time_run_onnx_ort_latency_098"]
2075+
stats["stat_estimated_speedup_ort_m98"] = (
2076+
summary["time_run_latency_m98"] / summary["time_run_onnx_ort_latency_m98"]
20712077
)
20722078
summary.update(stats)

0 commit comments

Comments
 (0)