Rate this Page

Working with Graph Breaks#

Created On: Jul 28, 2025 | Last Updated On: Sep 12, 2025

As you might remember from Dynamo Core Concepts that Dynamo performs a graph break when it encounters code that can’t be traced. In the default torch.compile settings, Dynamo compiles the FX graph that has been determined up to that point, executes the unsupported code in regular Python, and then resumes tracing.

Graph breaks enable Dynamo to trace through arbitrary Python code and carve out functional subgraphs that can each be individually optimized.

However, graph breaks may cause unexpected slowness in torch.compile. If you’re not seeing the expected speedups, we recommend checking for graph breaks and removing them.

The following sections outline strategies for addressing graph breaks.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources
Morty Proxy This is a proxified and sanitized view of the page, visit original site.