Skip to content

"where" operator is not working correctly in dpnp #1242

@mvyasank

Description

@mvyasank

Here is the example:
import dpnp as np
a = np.array([1,0.5,3,2,5,6])
b = np.where(a<=3)

Here is output:
_

TypeError Traceback (most recent call last)
Input In [30], in <cell line: 3>()
1 import dpnp as np
2 a = np.array([1,0.5,3,2,5,6])
----> 3 b = np.where(a<=3)
4 print (np.max(b),np.mean(b),np.abs(b))

File ~\Anaconda3\envs\my_env\lib\site-packages\dpnp\dpnp_iface_searching.py:187, in where(condition, x, y)
179 def where(condition, x=None, y=None):
180 """
181 Find indices where elements should be inserted to maintain order.
182
183 For full documentation refer to :obj:numpy.searchsorted.
184
185 """
--> 187 return call_origin(numpy.where, condition, x, y)

File dpnp\dpnp_utils\dpnp_algo_utils.pyx:168, in dpnp.dpnp_utils.dpnp_algo_utils.call_origin()

File ~\Anaconda3\envs\my_env\lib\site-packages\dpnp\dpnp_container.py:100, in empty(shape, dtype, order, device, usm_type, sycl_queue)
97 """Creates dpnp_array from uninitialized USM allocation."""
98 sycl_queue_normalized = normalize_queue_device(sycl_queue=sycl_queue, device=device)
--> 100 array_obj = dpt.empty(shape,
101 dtype=dtype,
102 order=order,
103 usm_type=usm_type,
104 sycl_queue=sycl_queue_normalized)
106 return dpnp_array(array_obj.shape, buffer=array_obj, order=order)

File ~\Anaconda3\envs\my_env\lib\site-packages\dpctl\tensor_ctors.py:446, in empty(sh, dtype, order, device, usm_type, sycl_queue)
444 sycl_queue = normalize_queue_device(sycl_queue=sycl_queue, device=device)
445 dtype = _get_dtype(dtype, sycl_queue)
--> 446 res = dpt.usm_ndarray(
447 sh,
448 dtype=dtype,
449 buffer=usm_type,
450 order=order,
451 buffer_ctor_kwargs={"queue": sycl_queue},
452 )
453 return res

File dpctl\tensor_usmarray.pyx:195, in dpctl.tensor._usmarray.usm_ndarray.cinit()

TypeError: can only concatenate str (not "numpy.dtype[object_]") to str_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions