Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: Fix the signature for np.array_api.take #24187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions numpy/array_api/_indexing_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

import numpy as np

def take(x: Array, indices: Array, /, *, axis: int) -> Array:
def take(x: Array, indices: Array, /, *, axis: Optional[int] = None) -> Array:
"""
Array API compatible wrapper for :py:func:`np.take <numpy.take>`.

See its docstring for more information.
"""
"""
if axis is None and x.ndim != 1:
raise ValueError("axis must be specified when ndim > 1")
if indices.dtype not in _integer_dtypes:
raise TypeError("Only integer dtypes are allowed in indexing")
if indices.ndim != 1:
if indices.ndim != 1:
raise ValueError("Only 1-dim indices array is supported")
return Array._new(np.take(x._array, indices._array, axis=axis))