Skip to content

Commit 9acdeb7

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

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
@@ -1386,6 +1386,7 @@ def unsqueeze(a: TensorLike, /, dim: int) -> TensorLike:
13861386

13871387
# TODO Review view functionalization
13881388
# TODO Add type annotations
1389+
# TODO(crcrpar): see [Return value of view creation ops]
13891390
@torchsymbol(torch.Tensor.view, is_method=True)
13901391
def view(a: TensorLike, /, *shape) -> TensorLike:
13911392
shape = utils.extract_shape_from_varargs(shape)
@@ -6627,6 +6628,11 @@ def check_overlap_ops():
66276628
_torch_to_thunder_function_map[torch.Tensor.reshape_as],
66286629
}
66296630

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

0 commit comments

Comments
 (0)