pytorch/torchgen/dest
David Watson c9cdcb299a Remove ExclusivelyOwned from register_dispatch_key (#106791)
This fixes a bug that could occur with python decompositions.

When an operation is intercepted in the c++ code in pytorch the outputs a created as `ExclusivelyOwned<at::Tensor>`s. Later on when it dispatches back to python for the decomposition these tensors have their ownership shared with python. In a normal use case the exclusively owned tensor is released and it's value returned as a non-exclusively owned tensor from the operation. However if the python decomposition throws an error the `ExclusivelyOwned` wrapper destroys the `at::Tensor` leading to a python reference to a tensor which isn't alive (and meaning pytorch falls over in debug mode).

Note this will be a performance hit when handling errors.

Fixes #106790

Pull Request resolved: https://github.com/pytorch/pytorch/pull/106791
Approved by: https://github.com/ezyang
2023-08-11 21:04:33 +00:00
..
__init__.py Apply ufmt linter to all py files under torchgen (#81570) 2022-07-16 03:52:25 +00:00
lazy_ir.py [BE] Enable flake8-simplify checks (#97984) 2023-03-31 03:40:21 +00:00
lazy_ts_lowering.py std/var: support floating point correction value (#94073) 2023-02-23 05:50:45 +00:00
native_functions.py Apply ufmt linter to all py files under torchgen (#81570) 2022-07-16 03:52:25 +00:00
register_dispatch_key.py Remove ExclusivelyOwned from register_dispatch_key (#106791) 2023-08-11 21:04:33 +00:00
ufunc.py Use OrderedSet in ufunc codegen (#82567) 2022-08-01 18:11:06 +00:00