Skip to content

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

Closed

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])

Activity

  1. added
    bug
    on Mar 9, 2023
  2. oleksandr-pavlyk commented on Mar 13, 2023

    @oleksandr-pavlyk
    Contributor

    Fixed via gh-1105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions