IntelPython / dpnp

Data Parallel Extension for NumPy
BSD 2-Clause "Simplified" License
99 stars 22 forks source link

Array manipulation routines #100

Open shssf opened 4 years ago

shssf commented 4 years ago

Need to implement following functions as described here Array manipulation routines

Basic operations

Changing array shape

Transpose-like operations

Changing number of dimensions

Changing kind of array

Joining arrays

Splitting arrays

Tiling arrays

Adding and removing elements

Rearranging elements

stisa commented 4 months ago

Just noticed that numpy repeat and dpnp repeat are slightly different, as dpnp doesn't allow repeating a non-array.

eg

import dpnp as dnp
dnp.repeat(0.05, 3) # error 'float' object has no attribute 'ndim'

import numpy as np
np.repeat(0.05, 3) # ok

Just leaving this here in case someone else is confused by the same thing.

antonwolfy commented 4 months ago

@stisa, thank you for noticing that.

As per documentation dpnp.repeat supports input array x of either dpnp.ndarray or usm_ndarray type.

We will prepare a PR to raise an explicit TypeError exception in case when x passed with unsupported type to make the issue more clear.