[dynamo] Convert invalid args into graph breaks (#121784)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/121784
Approved by: https://github.com/yanboliang
ghstack dependencies: #121615, #121616
This commit is contained in:
Jason Ansel
2024-03-13 07:22:01 -07:00
committed by PyTorch MergeBot
parent 5b90074540
commit 0df39480f6
50 changed files with 3 additions and 0 deletions

View File

@ -1729,6 +1729,9 @@ def get_fake_value(node, tx, allow_non_graph_fake=False):
)
elif isinstance(cause, ValueRangeError):
raise UserError(UserErrorType.CONSTRAINT_VIOLATION, e.args[0]) from e
elif isinstance(cause, TypeError) and "argument" in str(cause):
unimplemented(f"TypeError {node.target}: {cause}")
raise TorchRuntimeError(str(e)).with_traceback(e.__traceback__) from None
if not allow_non_graph_fake: