Skip to content

dpt.place wrong behavior with an empty values argument #1104

Closed
@vlad-perevezentsev

Description

@vlad-perevezentsev

When we pass an empty usm_ndarray for vals argument, dpt.place replaces the array elements to 0.

The original behavior of numpy.place throws ValueError exception.

#NUMPY
np_arr = np.arange(6)
np_mask = np_arr > 2
np_vals = np.array([], dtype='int32')

#DPT
dpt_arr = dpt.asarray(np_arr)
dpt_mask = dpt.asarray(np_mask)
dpt_vals = dpt.asarray(np_vals)

np.place(np_arr,np_mask,np_vals)
>>ValueError: Cannot insert from an empty array!

dpt.place(dpt_arr,dpt_mask,dpt_vals)
dpt_arr>>>usm_ndarray([0, 1, 2, 0, 0, 0])

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions