feat: add nextafter to specification#792
Merged
kgryte merged 1 commit intodata-apis:mainfrom May 2, 2024
Merged
Conversation
Contributor
Author
|
As this PR has received approval and no objections have been raised, will go ahead and merge. Should changes need to be made, we have time to correct before we cut the 2024 release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
nextafter#664 by addingnextafterto the specification.x2to an array for portable behavior. While NumPy and others support scalars (and this is a common use case), PyTorch only supports tensors forx2. In general, we are consistent throughout the specification in requiring that positional array arguments be strictly arrays. Were we to make an exception here, I'd imagine that the exception would apply equally to other arithmetic operations (e.g.,add,multiply, etc) for which we have standardized functional APIs.x2have the same data type asx1for portable behavior. Libraries are free to support other data types and subsequently type promotion (e.g., NumPy), but this should not be guaranteed across conforming array libraries, as the general expectation is that one typically wants the next representable value in the same precision asx1.x1andx2are equal and both zero, the result should bex2.