Skip to content

The discrepancy in strides between numpy and dpnp arrays #1649

Description

@chudur-budur

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?

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