Skip to content

Commit 73ea76c

Browse files
committed
TST: un-xfail tests of take(..., out=out)
1 parent e55688f commit 73ea76c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

torch_np/_funcs.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,15 @@ def asfarray():
929929

930930
# ### put/take_along_axis ###
931931

932+
932933
@normalizer
933-
def take(a: ArrayLike, indices: ArrayLike, axis=None, out : Optional[NDArray]=None, mode="raise"):
934-
if out is not None:
935-
raise NotImplementedError(f"{out=}")
934+
def take(
935+
a: ArrayLike,
936+
indices: ArrayLike,
937+
axis=None,
938+
out: Optional[NDArray] = None,
939+
mode="raise",
940+
):
936941
if mode != "raise":
937942
raise NotImplementedError(f"{mode=}")
938943

@@ -943,8 +948,6 @@ def take(a: ArrayLike, indices: ArrayLike, axis=None, out : Optional[NDArray]=No
943948
return result
944949

945950

946-
947-
948951
@normalizer
949952
def take_along_axis(arr: ArrayLike, indices: ArrayLike, axis):
950953
(arr,), axis = _util.axis_none_ravel(arr, axis=axis)

torch_np/tests/numpy_tests/core/test_multiarray.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3851,14 +3851,13 @@ def test_wrap(self):
38513851
assert_array_equal(np.take(x, [2], axis=0, mode='wrap')[0], x[0])
38523852
assert_array_equal(np.take(x, [3], axis=0, mode='wrap')[0], x[1])
38533853

3854-
@pytest.mark.xfail(reason="XXX: take(out=...)")
3854+
@pytest.mark.xfail(reason="XXX: take(mode='wrap')")
38553855
def test_out_overlap(self):
38563856
# gh-6272 check overlap on out
38573857
x = np.arange(5)
38583858
y = np.take(x, [1, 2, 3], out=x[2:5], mode='wrap')
38593859
assert_equal(y, np.array([1, 2, 3]))
38603860

3861-
@pytest.mark.xfail(reason="XXX: take(out=...)")
38623861
@pytest.mark.parametrize('shape', [(1, 2), (1,), ()])
38633862
def test_ret_is_out(self, shape):
38643863
# 0d arrays should not be an exception to this rule

0 commit comments

Comments
 (0)