Skip to content

Commit 5760de4

Browse files
committed
fix: Wrap perf benchmarks with no_grad
1 parent 4985c70 commit 5760de4

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tools/perf/perf_run.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -578,16 +578,17 @@ def recordStats(backend, timings, precision, batch_size=1, compile_time_s=None):
578578
if model_torch is not None:
579579
model_torch = model_torch.half()
580580

581-
status = run(
582-
model,
583-
backends,
584-
input_tensors,
585-
params,
586-
precision,
587-
batch_size,
588-
is_trt_engine,
589-
model_torch=model_torch,
590-
)
581+
with torch.no_grad():
582+
status = run(
583+
model,
584+
backends,
585+
input_tensors,
586+
params,
587+
precision,
588+
batch_size,
589+
is_trt_engine,
590+
model_torch=model_torch,
591+
)
591592

592593
# Generate report
593594
print("Model Summary: ", model_name)

0 commit comments

Comments
 (0)