Skip to content

Commit 59c6596

Browse files
committed
MAINT: remove a redundant one-liner
1 parent 50e0dd9 commit 59c6596

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

torch_np/_dtypes.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ def dtype(arg):
254254
return DType(arg)
255255

256256

257-
def torch_dtype_from(dtype_arg):
258-
return dtype(dtype_arg).torch_dtype
259-
260-
261257
class DType:
262258
def __init__(self, arg):
263259
# a pytorch object?

torch_np/_getlimits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55

66
def finfo(dtyp):
7-
torch_dtype = _dtypes.torch_dtype_from(dtyp)
7+
torch_dtype = _dtypes.dtype(dtyp).torch_dtype
88
return torch.finfo(torch_dtype)
99

1010

1111
def iinfo(dtyp):
12-
torch_dtype = _dtypes.torch_dtype_from(dtyp)
12+
torch_dtype = _dtypes.dtype(dtyp).torch_dtype
1313
return torch.iinfo(torch_dtype)
1414

1515

torch_np/_ndarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def round(self, decimals=0, out=None):
149149
# ctors
150150
def astype(self, dtype):
151151
newt = ndarray()
152-
torch_dtype = _dtypes.torch_dtype_from(dtype)
152+
torch_dtype = _dtypes.dtype(dtype).torch_dtype
153153
newt._tensor = self._tensor.to(torch_dtype)
154154
return newt
155155

@@ -439,7 +439,7 @@ def array(obj, dtype=None, *, copy=True, order="K", subok=False, ndmin=0, like=N
439439
# is a specific dtype requrested?
440440
torch_dtype = None
441441
if dtype is not None:
442-
torch_dtype = _dtypes.torch_dtype_from(dtype)
442+
torch_dtype = _dtypes.dtype(dtype).torch_dtype
443443
base = None
444444

445445
tensor = _util._coerce_to_tensor(obj, torch_dtype, copy, ndmin)

0 commit comments

Comments
 (0)