Skip to content

Commit fc372c2

Browse files
committed
MAINT: move result_or_out to normalizations
Optional arguments to the normalizer decorator turn out to be useful for quantile/percentile, which does non-standard things allowing zero-dim out arrays for size-out outputs etc.
1 parent 37be5c0 commit fc372c2

File tree

7 files changed

+126
-112
lines changed

7 files changed

+126
-112
lines changed

torch_np/_binary_ufuncs.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
from . import _helpers
44
from ._detail import _binary_ufuncs
5-
from ._normalizations import ArrayLike, DTypeLike, NDArray, SubokLike, normalizer
5+
from ._normalizations import (
6+
ArrayLike,
7+
DTypeLike,
8+
NDArray,
9+
OutArray,
10+
SubokLike,
11+
normalizer,
12+
)
613

714
__all__ = [
815
name for name in dir(_binary_ufuncs) if not name.startswith("_") and name != "torch"
@@ -29,12 +36,12 @@ def wrapped(
2936
subok: SubokLike = False,
3037
signature=None,
3138
extobj=None,
32-
):
39+
) -> OutArray:
3340
tensors = _helpers.ufunc_preprocess(
3441
(x1, x2), out, where, casting, order, dtype, subok, signature, extobj
3542
)
3643
result = torch_func(*tensors)
37-
return _helpers.result_or_out(result, out)
44+
return result, out
3845

3946
return wrapped
4047

torch_np/_decorators.py

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

0 commit comments

Comments
 (0)