Skip to content
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

docs: diff does not specify type promotion behavior #852

Closed
asmeurer opened this issue Nov 5, 2024 · 1 comment · Fixed by #881
Closed

docs: diff does not specify type promotion behavior #852

asmeurer opened this issue Nov 5, 2024 · 1 comment · Fixed by #881
Labels
bug Something isn't working. topic: Type Promotion Type promotion.
Milestone

Comments

@asmeurer
Copy link
Member

asmeurer commented Nov 5, 2024

diff() potentially takes multiple arrays as input (x, prepend, and append). But it doesn't specify if they should type promote together, or if the standard is only defined when prepend and append have the same data type as x

https://data-apis.org/array-api/draft/API_specification/generated/array_api.diff.html#diff

@kgryte kgryte added this to the v2024 milestone Nov 25, 2024
@kgryte kgryte added bug Something isn't working. topic: Type Promotion Type promotion. labels Nov 25, 2024
@kgryte kgryte changed the title diff() does not specify type promotion behavior docs: diff does not specify type promotion behavior Jan 9, 2025
@kgryte
Copy link
Contributor

kgryte commented Jan 9, 2025

In the current specification guidance, we state that prepend and append should have the same data type as x. Given that prepend and append are kwarg-only and we have yet, TMK, to specify an API in which array kwargs may affect the output dtype, personally, I do not think we should allow type promotion such that the output array may be of a different dtype than x.

However, I think we can clarify, in a note, that if an array library chooses to support prepend and append which are not of the same dtype as x, then behavior is implementation-defined.

kgryte added a commit to kgryte/array-api that referenced this issue Jan 9, 2025
kgryte added a commit that referenced this issue Jan 20, 2025
PR-URL: #881
Closes: #852
Reviewed-by: Ralf Gommers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. topic: Type Promotion Type promotion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants