Skip to content

Commit 5afc0e7

Browse files
committed
Prefer tuples to lists
Slightly more optimised
1 parent a75ae90 commit 5afc0e7

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
@@ -384,7 +384,7 @@ def repeat(self, repeats, axis=None):
384384
@staticmethod
385385
def _upcast_int_indices(index):
386386
if isinstance(index, torch.Tensor):
387-
if index.dtype in [torch.int8, torch.int16, torch.int32, torch.uint8]:
387+
if index.dtype in (torch.int8, torch.int16, torch.int32, torch.uint8):
388388
return index.to(torch.int64)
389389
elif isinstance(index, tuple):
390390
return tuple(ndarray._upcast_int_indices(i) for i in index)

0 commit comments

Comments
 (0)