extract shape in _view_has_unbacked_input (#160255)

Summary: We were getting DDE on reshape still!! i looked deeper and found an issue in _view_has_unbacked_input namely when input is [[,,]] it need to be normalized to [..]

Test Plan:
existing tests.

Rollback Plan:

Differential Revision: D79951119

Pull Request resolved: https://github.com/pytorch/pytorch/pull/160255
Approved by: https://github.com/bobrenjc93
This commit is contained in:
Laith Sakka 2025-08-12 08:38:15 +00:00 committed by PyTorch MergeBot
parent 9a0f7a3bb0
commit fea7e9dd37

View File

@ -514,6 +514,8 @@ def _compute_stride(old_shape, old_stride, new_shape, size_oblivious=False):
def _view_has_unbacked_input(a, shape): def _view_has_unbacked_input(a, shape):
from torch.fx.experimental.symbolic_shapes import has_hint from torch.fx.experimental.symbolic_shapes import has_hint
shape = utils.extract_shape_from_varargs(shape, validate=False)
return ( return (
any(not has_hint(s) for s in a.size()) any(not has_hint(s) for s in a.size())
or any(not has_hint(s) for s in a.stride()) or any(not has_hint(s) for s in a.stride())