mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert "[dynamo] Graph break on torch.Tensor.data
assignment with mismatched dtype (#156623)"
This reverts commit c1ad4b8e7a16f54c35a3908b56ed7d9f95eef586. Reverted https://github.com/pytorch/pytorch/pull/156623 on behalf of https://github.com/albanD due to Breaks Dynamo tests in trunk ([comment](https://github.com/pytorch/pytorch/pull/156623#issuecomment-3001806841))
This commit is contained in:
@ -2175,17 +2175,6 @@ class BuiltinVariable(VariableTracker):
|
||||
"the mutation out of `torch.compile` region",
|
||||
],
|
||||
)
|
||||
elif obj.dtype != val.dtype: # type: ignore[attr-defined]
|
||||
unimplemented_v2(
|
||||
gb_type="Failed to mutate tensor data attribute",
|
||||
context=f"setattr({obj}, {name}, {val})",
|
||||
explanation="Dyanmo only supports mutating `.data`"
|
||||
" of tensor to a new one with the same dtype",
|
||||
hints=[
|
||||
"Don't mutate `.data` on this tensor, or move "
|
||||
"the mutation out of `torch.compile` region",
|
||||
],
|
||||
)
|
||||
|
||||
# Remove the old reference in tracked fakes - if we don't do this
|
||||
# new .data value size and shape differences will cause
|
||||
|
Reference in New Issue
Block a user