From 1818d1d9f05f083bd06d096f5cb3d459a2a75096 Mon Sep 17 00:00:00 2001 From: chuanqiw Date: Tue, 9 Apr 2019 22:33:50 +0800 Subject: [PATCH] Reduce test_calibration test time by using large batchsize test=develop --- .../paddle/fluid/contrib/tests/test_calibration.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/paddle/fluid/contrib/tests/test_calibration.py b/python/paddle/fluid/contrib/tests/test_calibration.py index 00885eb5d6..16de604402 100644 --- a/python/paddle/fluid/contrib/tests/test_calibration.py +++ b/python/paddle/fluid/contrib/tests/test_calibration.py @@ -147,10 +147,11 @@ class TestCalibrationForResnet50(unittest.TestCase): self.data_cache_folder) os.system(cmd) - self.batch_size = 1 - self.sample_iterations = 50 + self.batch_size = 1 if os.environ.get('DATASET') == 'full' else 50 + self.sample_iterations = 50 if os.environ.get( + 'DATASET') == 'full' else 1 self.infer_iterations = 50000 if os.environ.get( - 'DATASET') == 'full' else 50 + 'DATASET') == 'full' else 1 def cache_unzipping(self, target_folder, zip_path): if not os.path.exists(target_folder): @@ -279,15 +280,15 @@ class TestCalibrationForResnet50(unittest.TestCase): def test_calibration(self): self.download_model() print("Start FP32 inference for {0} on {1} images ...").format( - self.model, self.infer_iterations) + self.model, self.infer_iterations * self.batch_size) (fp32_throughput, fp32_latency, fp32_acc1) = self.run_program(self.model_cache_folder + "/model") print("Start INT8 calibration for {0} on {1} images ...").format( - self.model, self.sample_iterations) + self.model, self.sample_iterations * self.batch_size) self.run_program( self.model_cache_folder + "/model", True, algo=self.algo) print("Start INT8 inference for {0} on {1} images ...").format( - self.model, self.infer_iterations) + self.model, self.infer_iterations * self.batch_size) (int8_throughput, int8_latency, int8_acc1) = self.run_program("calibration_out") delta_value = fp32_acc1 - int8_acc1 -- GitLab