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

feat: add diff to specification #791

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Apr 18, 2024

This PR

  • resolves RFC: add diff for computing the n-th forward difference #784 by adding diff to the specification.
  • restricts portable behavior for prepend and append to arrays. While NumPy and others support scalars (a common use case), PyTorch does not support scalars.
  • supports all numeric dtypes (real and complex floats, signed and unsigned integers).
  • allows some wiggle room for array libraries supporting "exotic" dtypes, such as datetimes, by stating that the output array "should" have the same data type as the input array x. E.g., NumPy supports datetimes and returns timedeltas. For numeric dtypes, the output array should always have the same dtype.
  • restricts prepend and append to the same data type as the input array. If we more generally allow any combination of dtypes among x, prepend, and append, we'd need to consider type promotion semantics. We don't have much, if any, precedent in the specification for array kwargs causing an input array to upcast, and I don't think we should establish precedent here.
  • set the defaults for prepend and append to None. This is in contrast to NumPy which doesn't set a default value.

@kgryte kgryte added the API extension Adds new functions or objects to the API. label Apr 18, 2024
@kgryte kgryte added the Needs Review Pull request which needs review. label Apr 18, 2024
@kgryte kgryte added this to the v2024 milestone Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API. Needs Review Pull request which needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: add diff for computing the n-th forward difference
1 participant