From 4c3639dd44f0f193c8cbacd0cdab271f29c9741a Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Mon, 2 Nov 2026 12:42:44 -0800 Subject: [PATCH] Create the trace directory in inductor_debug_cpu.py before exporting The profiling example exported Chrome traces to ./prof_trace, but nothing created that directory. The profiler logs an error and writes no file without raising, so the tutorial silently produced no traces, both for readers and in CI. --- intermediate_source/inductor_debug_cpu.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intermediate_source/inductor_debug_cpu.py b/intermediate_source/inductor_debug_cpu.py index 4b6d62c0b0d..8835a87bfec 100644 --- a/intermediate_source/inductor_debug_cpu.py +++ b/intermediate_source/inductor_debug_cpu.py @@ -424,8 +424,10 @@ def forward2(self, arg0_1): # We are able to get the profiling table and trace files. # bench.py +import os from torch.profiler import profile, schedule, ProfilerActivity RESULT_DIR = "./prof_trace" +os.makedirs(RESULT_DIR, exist_ok=True) my_schedule = schedule( skip_first=10, wait=5,