Skip to content

Commit 82daa32

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 8635edc commit 82daa32

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

acceleration/fast_inference_tutorial/fast_inference_tutorial.ipynb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@
370370
" total_time_dict = {}\n",
371371
" roi_size = (96, 96, 96)\n",
372372
" sw_batch_size = 4\n",
373-
" \n",
373+
"\n",
374374
" for idx, sample in enumerate(data_list[:10]):\n",
375375
" start = timer()\n",
376376
" data = infer_transforms({\"image\": sample})\n",
@@ -474,7 +474,9 @@
474474
" all_df = pd.merge(all_df, df, on=\"file_name\", how=\"left\")\n",
475475
"\n",
476476
"# for each file, add it's size\n",
477-
"all_df[\"file_size\"] = all_df[\"file_name\"].apply(lambda x: os.path.getsize(os.path.join(root_dir, \"Task03_Liver\", \"imagesTs_nii\", x)))\n",
477+
"all_df[\"file_size\"] = all_df[\"file_name\"].apply(\n",
478+
" lambda x: os.path.getsize(os.path.join(root_dir, \"Task03_Liver\", \"imagesTs_nii\", x))\n",
479+
")\n",
478480
"# sort by file size\n",
479481
"all_df = all_df.sort_values(by=\"file_size\", ascending=True)\n",
480482
"# convert file size to MB\n",
@@ -538,8 +540,14 @@
538540
],
539541
"source": [
540542
"print(\"TensorRT Improvement: \", (total_time[\"original_time\"] - total_time[\"trt_time\"]) / total_time[\"original_time\"])\n",
541-
"print(\"TensorRT + GPU Transforms Improvement: \", (total_time[\"original_time\"] - total_time[\"trt_gpu_transforms_time\"]) / total_time[\"original_time\"])\n",
542-
"print(\"TensorRT + GDS + GPU Transforms Improvement: \", (total_time[\"original_time\"] - total_time[\"trt_gds_gpu_transforms_time\"]) / total_time[\"original_time\"])"
543+
"print(\n",
544+
" \"TensorRT + GPU Transforms Improvement: \",\n",
545+
" (total_time[\"original_time\"] - total_time[\"trt_gpu_transforms_time\"]) / total_time[\"original_time\"],\n",
546+
")\n",
547+
"print(\n",
548+
" \"TensorRT + GDS + GPU Transforms Improvement: \",\n",
549+
" (total_time[\"original_time\"] - total_time[\"trt_gds_gpu_transforms_time\"]) / total_time[\"original_time\"],\n",
550+
")"
543551
]
544552
},
545553
{
@@ -562,10 +570,10 @@
562570
"total_time.index = [\"pytorch_model\", \"TensorRT\", \"TensorRT_GPU_Transform\", \"TensorRT_GPU_Transform_GDS\"]\n",
563571
"\n",
564572
"plt.figure(figsize=(10, 6))\n",
565-
"total_time.plot(kind='bar', color=['skyblue', 'orange', 'green', 'red'])\n",
566-
"plt.title('Total Inference Time for Each Benchmark Type')\n",
567-
"plt.xlabel('Benchmark Type')\n",
568-
"plt.ylabel('Total Time (seconds)')\n",
573+
"total_time.plot(kind=\"bar\", color=[\"skyblue\", \"orange\", \"green\", \"red\"])\n",
574+
"plt.title(\"Total Inference Time for Each Benchmark Type\")\n",
575+
"plt.xlabel(\"Benchmark Type\")\n",
576+
"plt.ylabel(\"Total Time (seconds)\")\n",
569577
"plt.xticks(rotation=45)\n",
570578
"plt.tight_layout()\n",
571579
"plt.show()"

0 commit comments

Comments
 (0)