diff --git a/onnxruntime/python/tools/tensorrt/perf/benchmark.py b/onnxruntime/python/tools/tensorrt/perf/benchmark.py index 966c360a3a..0f06676641 100644 --- a/onnxruntime/python/tools/tensorrt/perf/benchmark.py +++ b/onnxruntime/python/tools/tensorrt/perf/benchmark.py @@ -89,7 +89,13 @@ TRT_ENGINE_CACHE_DIR_NAME = "engine_cache" def split_and_sort_output(string_list): string_list = string_list.split("\n") - string_list.sort() + + def custom_sort(item): + # Parse digits + numbers = re.findall(r"\d+", item) + return int(numbers[0]) if numbers else float("inf") + + string_list.sort(key=custom_sort) return string_list