From 0ad801a184c0de19c40a98d016107ec7b12edc25 Mon Sep 17 00:00:00 2001 From: Jan Iwaszkiewicz Date: Tue, 16 Jan 2024 15:08:05 +0100 Subject: [PATCH] [PyOV][SAMPLES] Fix bugbear issue B038 (#22183) --- samples/python/benchmark/bert_benchmark/bert_benchmark.py | 2 +- .../benchmark/throughput_benchmark/throughput_benchmark.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/python/benchmark/bert_benchmark/bert_benchmark.py b/samples/python/benchmark/bert_benchmark/bert_benchmark.py index b15bbd48b34c84..f81eac29387182 100755 --- a/samples/python/benchmark/bert_benchmark/bert_benchmark.py +++ b/samples/python/benchmark/bert_benchmark/bert_benchmark.py @@ -57,7 +57,7 @@ def main(): sst2_sentences = sst2['validation']['sentence'] # Warm up encoded_warm_up = dict(tokenizer('Warm up sentence is here.', return_tensors='np')) - for _ in ireqs: + for _ in range(len(ireqs)): ireqs.start_async(encoded_warm_up) ireqs.wait_all() # Benchmark diff --git a/samples/python/benchmark/throughput_benchmark/throughput_benchmark.py b/samples/python/benchmark/throughput_benchmark/throughput_benchmark.py index 0573642fb2fdaa..ce9431e3e5121d 100755 --- a/samples/python/benchmark/throughput_benchmark/throughput_benchmark.py +++ b/samples/python/benchmark/throughput_benchmark/throughput_benchmark.py @@ -52,7 +52,7 @@ def main(): for model_input in compiled_model.inputs: fill_tensor_random(ireq.get_tensor(model_input)) # Warm up - for _ in ireqs: + for _ in range(len(ireqs)): ireqs.start_async() ireqs.wait_all() # Benchmark for seconds_to_run seconds and at least niter iterations