Skip to content

Commit a73c554

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

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)
@@ -6756,6 +6757,11 @@ def check_overlap_ops():
67566757
_torch_to_thunder_function_map[torch.Tensor.reshape_as],
67576758
}
67586759

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

0 commit comments

Comments
 (0)