Skip to content

Commit 51853b3

Browse files
janselpytorchmergebot
authored andcommitted
[dynamo] Improve error message for cond aliasing (pytorch#156963)
See pytorch#156724 Pull Request resolved: pytorch#156963 Approved by: https://github.com/zou3519, https://github.com/williamwen42
1 parent 6b05842 commit 51853b3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

torch/_dynamo/graph_break_registry.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@
391391
"Context": "context",
392392
"Explanation": "Higher order ops do not support aliasing. Found in {source_target.name()}",
393393
"Hints": [
394+
"Replace `return input` with `return input.clone()` to avoid aliasing.",
394395
"Consider using the debug context to change user code to avoid aliasing.",
395396
"Please open an issue."
396397
]

torch/_dynamo/variables/higher_order_ops.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ def move_lifted_freevars_phs_to_end(
838838
context=context,
839839
explanation=f"Higher order ops do not support aliasing. Found in {source_target.name()}",
840840
hints=[
841+
"Replace `return input` with `return input.clone()` to avoid aliasing.",
841842
"Consider using the debug context to change user code to avoid aliasing.",
842843
"Please open an issue.",
843844
],

0 commit comments

Comments
 (0)