Skip to content

More documentation of out of bounds behavior for jnp.take #33489

@unalmis

Description

@unalmis

In this method for jnp.take https://docs.jax.dev/en/latest/_autosummary/jax.numpy.take.html, there is some perhaps conflicting information that would benefit from documentation on which takes precedence.

When mode=fill, out of bounds indexes are set to fill_value. At the same time, it is said that when unique_indices=True and the indices are not unique, the output is undefined. If all the indexes which are in bounds are unique, and only the out of bounds indices are not unique, what is the promised behavior?

In my code, I have an array a of size N and and an array indices of size <=N. The first K<=N elements of indices are unique, sorted and in bounds for a, while the last N-K elements are the same number which is an out of bounds index for a, e.g. a.size. In my code, with mode=fill and unique_indices=True, I see my desired behavior of filling all the out of bounds indices to the fill_value. Is this the promised behavior?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions