Skip to content

Commit 215cf55

Browse files
committed
Favour t.to() over t.type() for dtype conversions
1 parent 36e343e commit 215cf55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch_np/_ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def repeat(self, repeats, axis=None):
385385
def _upcast_int_indices(index):
386386
if isinstance(index, torch.Tensor):
387387
if index.dtype in [torch.int8, torch.int16, torch.int32]:
388-
return index.type(torch.int64)
388+
return index.to(torch.int64)
389389
elif isinstance(index, tuple):
390390
return tuple(ndarray._upcast_int_indices(i) for i in index)
391391
return index

0 commit comments

Comments
 (0)