Skip to content

Commit d682407

Browse files
committed
view calls to when *shape is torch.dtype
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
1 parent ae51153 commit d682407

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎thunder/torch/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,8 @@ def unsqueeze(a: TensorLike, /, dim: int) -> TensorLike:
13891389
@torchsymbol(torch.Tensor.view, is_method=True)
13901390
def view(a: TensorLike, /, *shape) -> TensorLike:
13911391
shape = utils.extract_shape_from_varargs(shape)
1392+
if len(shape) == 1 and isinstance(shape[0], torch.dtype):
1393+
return to(a, dtype=shape[0])
13921394
return reshape(a, shape)
13931395

13941396

0 commit comments

Comments
 (0)