From 3efe0a251432ce92f5faecc98ecd85ad48920c30 Mon Sep 17 00:00:00 2001 From: Thomas Viehmann Date: Sat, 22 May 2021 07:34:58 +0200 Subject: [PATCH] Increase mimimum number of warmup runs to 2 The JIT will typically need two warmup runs to do profiling and optimization. --- torch/utils/benchmark/utils/timer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/utils/benchmark/utils/timer.py b/torch/utils/benchmark/utils/timer.py index f47cc1537a26..428196eac8b2 100644 --- a/torch/utils/benchmark/utils/timer.py +++ b/torch/utils/benchmark/utils/timer.py @@ -259,7 +259,7 @@ def timeit(self, number: int = 1000000) -> common.Measurement: """ with common.set_torch_threads(self._task_spec.num_threads): # Warmup - self._timer.timeit(number=max(int(number // 100), 1)) + self._timer.timeit(number=max(int(number // 100), 2)) return common.Measurement( number_per_run=number,