Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 2103a14

Browse files
author
Zhang Yan
committed
skip 3 steps in benchmarking
1 parent 55e0d4b commit 2103a14

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dl_bench/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,14 @@ def inference(self, backend: Backend):
402402
self.net.eval()
403403
outputs = []
404404
fw_times = []
405+
skip_steps = 3
405406
with torch.no_grad():
406407
start = time.perf_counter()
407408
# Duration is inconsistent now
408409
with tm.timeit("duration_s"):
409-
while True:
410+
for i, x in enumerate(test_loader):
410411
s = get_time()
411-
x = backend.to_device(sample)
412+
x = backend.to_device(x)
412413
if backend.dtype != torch.float32:
413414
with torch.autocast(
414415
device_type=backend.device_name,
@@ -417,7 +418,7 @@ def inference(self, backend: Backend):
417418
y = self.net(x)
418419
else:
419420
y = self.net(x)
420-
421+
if i < 3: continue
421422
fw_times.append(get_time() - s)
422423
n_items += len(x)
423424
outputs.append(y)

0 commit comments

Comments
 (0)