Skip to content

Commit 0029bbf

Browse files
committed
add TODO to improve/correct return value for view creation ops
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
1 parent 1ae0da9 commit 0029bbf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

thunder/torch/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ def unsqueeze(a: TensorLike, /, dim: int) -> TensorLike:
14921492

14931493
# TODO Review view functionalization
14941494
# TODO Add type annotations
1495+
# TODO(crcrpar): see [Return value of view creation ops]
14951496
@torchsymbol(torch.Tensor.view, is_method=True)
14961497
def view(a: TensorLike, /, *shape) -> TensorLike:
14971498
shape = utils.extract_shape_from_varargs(shape)
@@ -6740,6 +6741,11 @@ def check_overlap_ops():
67406741
_torch_to_thunder_function_map[torch.Tensor.reshape_as],
67416742
}
67426743

6744+
# TODO(crcrpar): [Return value of view creation ops]
6745+
# Review what's more appropriate return value from the ops below.
6746+
# Currently they return a new tensor, which obscures the nature of these ops, i.e.,
6747+
# outputs share underlying storage with inputs. For more stable and improved in-place support
6748+
# it'd be necessary to think about e.g. extending TensorProxy and/or DCE.
67436749
_syms_returning_views: set[Symbol] = {
67446750
diagonal,
67456751
expand,

0 commit comments

Comments
 (0)