Optimize PyTorch with torch.compile (TorchDynamo/Inductor), focusing on compile overhead, graph breaks, and benchmark methodology. Use when speeding up PyTorch models or debugging compile behavior; triggers: torch.compile, torchdynamo, inductor, graph break, pytorch optimization.
Use torch.compile to JIT-compile PyTorch code into optimized kernels, then validate speedups with warmups and graph-break audits.
Use this skill only when the frontmatter triggers apply; otherwise keep eager mode.
torch._dynamo.explain or logging and reduce non-tensor logic.torch._dynamo.explain on the target function.scripts/torch-compile_tool.py: CLI for probing torch.compile availability, benchmarking, and explain output.scripts/torch-compile_tool.js: Node.js wrapper for the same CLI.PyTorch深度学习模式与最佳实践,用于构建稳健、高效且可复现的训练流程、模型架构和数据加载。