GB0142
Graph-Break Type
Short name describing what triggered the graph break
Unsupported context manager
Context
Values or code snippet captured at the break point
Attempted SETUP_WITH/BEFORE_WITH on {ctx}
Explanation
Explanation of why the graph break was triggered
Dynamo does not know how to enter a {ctx.python_type_name()}
context manager.
Hints
Hints on how to resolve the graph break
- Avoid using the unsupported context manager.
- If the context manager seems like it should be supported (e.g. torch.set_grad_enabled), then
- it may be the case that it was created outside the compiled region, which Dynamo does not support.
- Supported context managers can cross graph break boundaries only if they are local non-closure
- variables, or are intermediate values.
- File an issue to PyTorch. Simple context managers can potentially be supported,
- but note that context managers can’t be supported in general
Back to Registry