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

Align with dpt.where which support scalar as input #1932

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions dpnp/dpnp_iface_searching.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,12 @@

"""

# pylint: disable=no-name-in-module

import dpctl.tensor as dpt
import dpctl.tensor._tensor_impl as dti

import dpnp

from .dpnp_array import dpnp_array
from .dpnp_utils import (
get_usm_allocations,
)
from .dpnp_utils.dpnp_utils_reduction import dpnp_wrap_reduction_call

__all__ = ["argmax", "argmin", "searchsorted", "where"]
Expand Down Expand Up @@ -395,13 +390,6 @@ def where(condition, x=None, y=None, /, *, order="K", out=None):
usm_y = dpnp.get_usm_ndarray_or_scalar(y)
usm_condition = dpnp.get_usm_ndarray(condition)

usm_type, queue = get_usm_allocations([condition, x, y])
if dpnp.isscalar(usm_x):
usm_x = dpt.asarray(usm_x, usm_type=usm_type, sycl_queue=queue)

if dpnp.isscalar(usm_y):
usm_y = dpt.asarray(usm_y, usm_type=usm_type, sycl_queue=queue)

usm_out = None if out is None else dpnp.get_usm_ndarray(out)
result = dpnp_array._create_from_usm_ndarray(
dpt.where(usm_condition, usm_x, usm_y, order=order, out=usm_out)
Expand Down
Loading