Repository navigation
Support boolean input in dpnp.positive - #3128
Open
antonwolfy wants to merge 1 commit into
Open
antonwolfy wants to merge 1 commit into
antonwolfy wants to merge 1 commit into
Conversation
NumPy 2.6 defines `positive` and the unary `+` operator for boolean arrays, returning a boolean copy instead of raising `TypeError`. Align `dpnp.positive` by running the `abs` kernel for boolean input, which is the identity on bool, as NumPy reuses its `absolute` loop. `dpnp.tensor.positive` is unchanged.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
October 25, 2026 14:04
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3128/index.html |
Collaborator
This branch has not been deployed
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.
NumPy 2.6 defines
numpy.positiveand the unary+operator for boolean arrays: they return a boolean copy of the input instead of raisingTypeError. This PR alignsdpnp.positiveand+ondpnp.ndarraywith that behavior.dpnp.tensor.positivehas no boolean loop, so for boolean inputdpnp.positiveruns thedpnp.tensorabskernel, which returns boolean values unchanged. NumPy reuses itsabsoluteloop for this case the same way. Other dtypes still use thepositivekernel.dpnp.tensor.positiveand+onusm_ndarrayare unchanged.The acceptance function that raised
TypeErrorfor boolean input is removed, since boolean input now has its own loop and never goes through type promotion.