pytorch/torch/_dynamo/variables
Ryan Guo 39d1c91c33 [dynamo] Restrict support for out= variants of torch operators (#140202)
There has been a series of attempts to provide support for resizing in
torch operators like `torch.sigmoid(x, out=y)`, i.e., `y` would have a
different shape before and after this expression. Prior to this patch,
we have some checks to graph break if the shape changed.

This patch extends
1. extends the existing check and graph break for any shape change, not
   just for `TensorVariable` with source field.
2. removes an old code path which was introduced to address the shape
   change, but became obselete in that regard because we added extra
   checks to graph break upon shape change. Moreover, this old code path
   is unsound, it tries to replace references to the old
   `TensorVariable` the new one returned by `wrap_fx_proxy`, but it only
   does the replacement in `symbolic_locals`, which breaks when cells
   are involved. In general the old `TensorVariable` could be _anywhere_,
   think the `replace_all` we had for immutable VTs.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/140202
Approved by: https://github.com/jansel
ghstack dependencies: #140035, #140036, #140149, #140150, #140151, #140201
2024-11-13 03:14:23 +00:00
..
__init__.py [Dynamo] Allow filter() to handle infinite iterator (#138305) 2024-11-12 17:32:56 +00:00
base.py [dynamo] Add is_mutable() and is_immutable() methods to VariableTracker (#139341) 2024-11-05 19:11:41 +00:00
builder.py add special case for __round__ constant variables (#139583) 2024-11-09 03:25:53 +00:00
builtin.py [Dynamo] Allow filter() to handle infinite iterator (#138305) 2024-11-12 17:32:56 +00:00
constant.py add special case for __round__ constant variables (#139583) 2024-11-09 03:25:53 +00:00
ctx_manager.py [Dynamo] Trace enter/exit of TorchFunctionModes (#135422) (#137114) 2024-10-09 02:29:40 +00:00
dicts.py [dynamo] Add is_mutable() and is_immutable() methods to VariableTracker (#139341) 2024-11-05 19:11:41 +00:00
distributed.py Revert "[dynamo] Fix constant propagation in builtins and UserClasses (#131354)" 2024-11-01 00:13:20 +00:00
functions.py [dynamo] Fix some corner cases for modeling pre-existing cells (#140150) 2024-11-13 03:14:23 +00:00
higher_order_ops.py Add base class for single-subgraph inductor HOPs (#139898) 2024-11-11 16:12:35 +00:00
iter.py [Dynamo] Allow filter() to handle infinite iterator (#138305) 2024-11-12 17:32:56 +00:00
lazy.py [dynamo] Replace __str__ with __repr__ in some places (#136316) 2024-10-21 19:50:38 +00:00
lists.py [dynamo] Add is_mutable() and is_immutable() methods to VariableTracker (#139341) 2024-11-05 19:11:41 +00:00
misc.py [dynamo] Remove cell unboxing/restart optimization (#140149) 2024-11-13 03:14:23 +00:00
nn_module.py [dynamo] Remove dead code path for capturing __class__ in UserFunctionVariable (#140034) 2024-11-12 05:54:35 +00:00
optimizer.py [dynamo] Simplify creation of VariableTrackers (#135714) 2024-10-18 09:36:46 +00:00
script_object.py Add basic mypy annotations to dynamo (#132415) 2024-08-04 18:43:36 +00:00
sdpa.py [dynamo] Simplify creation of VariableTrackers (#135714) 2024-10-18 09:36:46 +00:00
tensor.py Make size a property with an assertion (#139794) 2024-11-09 03:39:41 +00:00
torch_function.py [dynamo] Simplify creation of VariableTrackers (#135714) 2024-10-18 09:36:46 +00:00
torch.py [dynamo] Restrict support for out= variants of torch operators (#140202) 2024-11-13 03:14:23 +00:00
user_defined.py fix trace nn.parameters() (#138149) 2024-11-12 09:43:45 +00:00