Skip to content

Commit faf2350

Browse files
authored
Merge pull request #94 from Quansight-Labs/merge_detail
Merge wrapper and implementations
2 parents f267249 + 95485c2 commit faf2350

12 files changed

+1422
-1984
lines changed

torch_np/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
from . import random
22
from ._binary_ufuncs import *
3-
from ._detail._index_tricks import *
43
from ._detail._util import AxisError, UFuncTypeError
54
from ._dtypes import *
65
from ._funcs import *
76
from ._getlimits import errstate, finfo, iinfo
87
from ._ndarray import array, asarray, can_cast, ndarray, newaxis, result_type
98
from ._unary_ufuncs import *
10-
from ._wrapper import *
119

1210
# from . import testing
1311

torch_np/_binary_ufuncs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def divmod(
8686
out1: Optional[NDArray] = None,
8787
out2: Optional[NDArray] = None,
8888
/,
89-
out: Optional[tuple[NDArray]] = (None, None),
89+
out: tuple[Optional[NDArray], Optional[NDArray]] = (None, None),
9090
*,
9191
where=True,
9292
casting="same_kind",

torch_np/_detail/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
from ._flips import *
21
from ._reductions import *
3-
4-
# leading underscore (ndarray.flatten yes, np.flatten no)
5-
from .implementations import *
6-
from .implementations import _flatten

torch_np/_detail/_flips.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

torch_np/_detail/_index_tricks.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

torch_np/_detail/_util.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,36 +170,6 @@ def typecast_tensors(tensors, target_dtype, casting):
170170
return tuple(cast_tensors)
171171

172172

173-
def axis_expand_func(func, tensor, axis, *args, **kwds):
174-
"""Generically handle axis arguments in reductions."""
175-
if axis is not None:
176-
if not isinstance(axis, (list, tuple)):
177-
axis = (axis,)
178-
axis = normalize_axis_tuple(axis, tensor.ndim)
179-
180-
if axis == ():
181-
newshape = expand_shape(tensor.shape, axis=0)
182-
tensor = tensor.reshape(newshape)
183-
axis = (0,)
184-
185-
result = func(tensor, axis=axis, *args, **kwds)
186-
187-
return result
188-
189-
190-
def axis_ravel_func(func, tensor, axis, *args, **kwds):
191-
"""Generically handle axis arguments in cumsum/cumprod."""
192-
if axis is not None:
193-
axis = normalize_axis_index(axis, tensor.ndim)
194-
195-
tensors, axis = axis_none_ravel(tensor, axis=axis)
196-
tensor = tensors[0]
197-
198-
result = func(tensor, axis=axis, *args, **kwds)
199-
200-
return result
201-
202-
203173
def _coerce_to_tensor(obj, dtype=None, copy=False, ndmin=0):
204174
"""The core logic of the array(...) function.
205175

0 commit comments

Comments
 (0)