Skip to content

Add property flags to dpnp_array #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

densmirn
Copy link
Contributor

No description provided.

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, adding a test would be great too.

Copy link
Contributor

@Alexander-Makaryev Alexander-Makaryev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests should check the correctness/expected results of the functionality.
But these tests check something else... maybe they check that we can create 2 objects with the equal property, is not it?)
The example below demonstrates this.
As you can see, the current implementation does not provide the expected functionality, but tests pass.

In [1]: import dpctl.tensor as dpt

In [2]: shape = (5, 2)

In [3]: X = dpt.usm_ndarray(shape)

In [4]: X.flags
Out[4]: 1

In [5]: type(X.flags)
Out[5]: int

In [6]: import numpy

In [7]: Y = numpy.ndarray((2,5))

In [8]: Y.flags
Out[8]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False

In [9]: type(Y.flags)
Out[9]: numpy.flagsobj

@densmirn
Copy link
Contributor Author

Tests should check the correctness/expected results of the functionality. But these tests check something else... maybe they check that we can create 2 objects with the equal property, is not it?) The example below demonstrates this. As you can see, the current implementation does not provide the expected functionality, but tests pass.

In [1]: import dpctl.tensor as dpt

In [2]: shape = (5, 2)

In [3]: X = dpt.usm_ndarray(shape)

In [4]: X.flags
Out[4]: 1

In [5]: type(X.flags)
Out[5]: int

In [6]: import numpy

In [7]: Y = numpy.ndarray((2,5))

In [8]: Y.flags
Out[8]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False

In [9]: type(Y.flags)
Out[9]: numpy.flagsobj

dpnp is based on dpctl in case of property flags where flags differ numpy. Tests check dpnp flags are equal to dpctl flags.

@densmirn densmirn added the enhancement New feature or request label Jan 21, 2022
@densmirn
Copy link
Contributor Author

In case if we dpnp should work like numpy in case of flags, I vote for closing the PR.

@antonwolfy
Copy link
Contributor

Done in #1265

@antonwolfy antonwolfy closed this Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants