Skip to content

Add property flags to dpnp_array #1265

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

Merged
merged 4 commits into from
Dec 24, 2022
Merged

Add property flags to dpnp_array #1265

merged 4 commits into from
Dec 24, 2022

Conversation

npolina4
Copy link
Contributor

Added property flags to dpnp_array by using dpctl.tensor.usm_ndarray.flags.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • If this PR is a work in progress, are you filing the PR as a draft?

Comment on lines 45 to 47
expected = dpt.usm_ndarray(shape, order=order)
result = dpnp.ndarray(shape, order=order)
assert expected.flags == result.flags
Copy link
Contributor

@antonwolfy antonwolfy Dec 22, 2022

Choose a reason for hiding this comment

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

what if to extend the test (or add additional one), where to compare flags with numpy array? like:

Suggested change
expected = dpt.usm_ndarray(shape, order=order)
result = dpnp.ndarray(shape, order=order)
assert expected.flags == result.flags
usm_array = dpt.usm_ndarray(shape, order=order)
numpy_array = numpy.ndarray(shape, order=order)
dpnp_array = dpnp.ndarray(shape, order=order)
assert usm_array.flags == dpnp_array.flags
assert numpy_array.flags.c_contiguous == dpnp_array.flags.c_contiguous
assert numpy_array.flags.f_contiguous == dpnp_array.flags.f_contiguous

@pytest.mark.parametrize("order",
["C", "F"],
ids=['C', 'F'])
def test_flags(shape, order):
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess, also it would be good to add a test of flags with different strides.

@npolina4 npolina4 merged commit 62fa3ab into master Dec 24, 2022
@npolina4 npolina4 deleted the feature_flags branch December 24, 2022 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants