Type promotion for indices arrays and casting vals in integer indexing#1647
Merged
ndgrigorian merged 6 commits intomasterfrom Apr 21, 2024
Merged
Type promotion for indices arrays and casting vals in integer indexing#1647ndgrigorian merged 6 commits intomasterfrom
indices arrays and casting vals in integer indexing#1647ndgrigorian merged 6 commits intomasterfrom
Conversation
Setting items in an array now casts the right-hand side to the array data type when the data types differ Setting and getting from an empty axis with non-empty indices now throws `IndexError`
Fixes `take` and `put` being used on non-empty axes with non-empty indices Also adds a note to `put` about race conditions for non-unique indices
Also corrects error raised in _put_multi_index when attempting to put into indices along an empty axis
|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_305 ran successfully. |
Collaborator
Contributor
oleksandr-pavlyk
left a comment
There was a problem hiding this comment.
Needed change overall! Two small nits :)
Thanks for working on this @ndgrigorian !
|
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_306 ran successfully. |
This was referenced Apr 21, 2024
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 pull request proposes resolutions to #1360, #1382, and #1482 by changing the behavior of advanced indexing and indexing functions.
x[i_0, i_1, ...]now promotes arraysi_0 ... i_Nto an appropriate integer data type, and only raises where such a data type cannot be foundx[indices] = valsnow castsvalsto the data type ofxregardless of type. This aligns withplace/boolean indexing.dpt.putnow warns the user about race conditions when indices are not uniqueAdditionally, this PR implements changes to
take,put, and generalized advanced integer indexing which handle cases where empty axes are being indexed.