Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit b3b02f5

Browse files
author
DEKHTIARJonathan
committed
Prefetch on GPU cleanup & Cleanup
1 parent 38e0681 commit b3b02f5

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

tftrt/examples/benchmark_runner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,14 @@ def log_step(step_idx, display_every, iter_time, memcpyHtoD_time, dequeue_time):
432432
print("[Exiting] Reached end of dataset ...")
433433
break
434434

435+
with tracing_ctx('Inputs Preprocessing', step_num=step_idx, _r=1):
436+
x, y = self.preprocess_model_inputs(data_batch)
437+
435438
with tracing_ctx('Inputs MemcpyHtoD', step_num=step_idx, _r=1):
436439
start_time = time.time()
437-
data_batch = force_data_on_gpu_fn(data_batch)
440+
x = force_data_on_gpu_fn(x)
438441
memcopy_times.append(time.time() - start_time)
439442

440-
with tracing_ctx('Inputs Preprocessing', step_num=step_idx, _r=1):
441-
x, y = self.preprocess_model_inputs(data_batch)
442-
443443
with tracing_ctx('GPU Inference', step_num=step_idx, _r=1):
444444
start_time = time.time()
445445
y_pred = infer_batch(x)

tftrt/examples/nvidia_examples/efficientnet_base/infer.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@ def preprocess_model_inputs(self, data_batch):
221221

222222
x, y = data_batch
223223

224-
x = {
225-
"image": x['image'],
226-
"mixup_weight": x['mixup_weight'],
227-
"cutmix_mask": x['cutmix_mask'],
228-
"is_tr_split": x['is_tr_split']
229-
}
230-
231224
return x, y
232225

233226
def postprocess_model_outputs(self, predictions, expected):

0 commit comments

Comments
 (0)