dpnp icon indicating copy to clipboard operation
dpnp copied to clipboard

The discrepancy in strides between numpy and dpnp arrays

Open chudur-budur opened this issue 1 year ago • 0 comments

I think the stride computation in dpnp arrays is not correct.

>>> import numpy as np
>>> import dpnp
>>> a = np.arange(0, 10, dtype=dpnp.int64)
>>> a.strides
(8,)
>>> b = dpnp.arange(0, 10, dtype=dpnp.int64)
>>> b.strides
(1,)
>>> c = np.arange(0, 10, dtype=dpnp.int32)
>>> c.strides
(4,)
>>> d = dpnp.arange(0, 10, dtype=dpnp.int32)
>>> d.strides
(1,)
>>> p = a[::2]
>>> p.strides
(16,)
>>> q = b[::2]
>>> q.strides
(2,)
>>> r = c[::2]
>>> r.strides
(8,)
>>> s = d[::2]
>>> s.strides
(2,)

Why is that?

chudur-budur avatar Jan 03 '24 20:01 chudur-budur