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

Add support of bool type in bitwise operations #1334

Merged
merged 3 commits into from
Mar 7, 2023

Conversation

antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Mar 6, 2023

The PR implements support of input array with bool type for the following dpnp functions:

  • bitwise_and
  • bitwise_not
  • bitwise_or
  • bitwise_xor
  • invert

All relating built-in operations for dpnp_array class are added.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • If this PR is a work in progress, are you filing the PR as a draft?

@antonwolfy antonwolfy force-pushed the bool_bitwise_ops branch 2 times, most recently from a5ca19b to 88e8cca Compare March 7, 2023 08:54
Copy link
Collaborator

@vlad-perevezentsev vlad-perevezentsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@antonwolfy antonwolfy merged commit 29a2063 into IntelPython:master Mar 7, 2023
@antonwolfy antonwolfy deleted the bool_bitwise_ops branch March 7, 2023 12:14
@oleksandr-pavlyk
Copy link
Contributor

Testing:


In [1]: import dpnp

In [2]: x = dpnp.random.randn(200)

In [10]: dpnp.all(x[dpnp.bitwise_xor(x<-1, x > 1)] == x[dpnp.bitwise_or(x<-1, x>1)])
Out[10]: True


In [11]: dpnp.any(dpnp.bitwise_and(x<-1, x > 1))
Out[11]: False

In [12]: dpnp.all(dpnp.invert(dpnp.bitwise_and(x<-1, x > 1)))
Out[12]: True

antonwolfy added a commit that referenced this pull request Mar 7, 2023
* Add dpnp.broadcast_to() function (#1333)

* Add support of bool type in bitwise operations (#1334)

* Add support of bool type in bitwise operations

* Update dpnp/dpnp_algo/dpnp_algo_bitwise.pyx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants