Fix GuardOnDataDependentSymNode UserError to preserve original exception (#176016)
Summary:
Fixes #111075.
When exporting, the branch that handles `GuardOnDataDependentSymNode` raised a new `UserError` without chaining the original exception. This could hide the underlying cause.
This PR updates that branch in `torch/_dynamo/utils.py` to use `raise UserError(... ) from cause`, so the original exception is preserved while still surfacing the user-friendly error.
X-link: https://github.com/pytorch/pytorch/pull/176016
Approved by: https://github.com/Lucaskabela
Reviewed By: huydhn
Differential Revision: D96281675
fbshipit-source-id: c7f9edf87c352a47cf0f25619ff3ece23ca75b32
Author
generatedunixname499836121