Track base of FunctionalTensor in inference mode. (#135141)

The idea behind the tracking is the following, whenever we see a tensor if the tensors is a root tensors (does not have any view metas ) when we consider is as the base of the all the tensors that shares its storage.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/135141
Approved by: https://github.com/zou3519
This commit is contained in:
Laith Sakka
2024-09-05 13:34:28 -07:00
committed by PyTorch MergeBot
parent cc28634172
commit 66dd4577b1
7 changed files with 74 additions and 87 deletions

View File

@ -781,6 +781,9 @@ def gen_pyi(
"_is_functional_tensor": [
"def _is_functional_tensor(t: Tensor) -> _bool: ..."
],
"_is_functional_tensor_base": [
"def _is_functional_tensor_base(t: Tensor) -> _bool: ..."
],
"_from_functional_tensor": [
"def _from_functional_tensor(t: Tensor) -> Tensor: ..."
],