Skip to content

docs: diff does not specify type promotion behavior #852

Closed

Description

@asmeurer

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

Activity

  1. added this to the v2024 milestone on Nov 25, 2024
  2. changed the title [-]diff() does not specify type promotion behavior[/-] [+]docs: `diff` does not specify type promotion behavior[/+] on Jan 9, 2025
  3. kgryte commented on Jan 9, 2025

    @kgryte
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions