Skip to content
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

Added missing dpnp.column_stack, dpnp.dstack and dpnp.row_stack #1647

Merged
merged 11 commits into from
Dec 22, 2023

Conversation

antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Dec 20, 2023

The PR proposes to implement missing manipulation functions: dpnp.column_stack, dpnp.dstack and dpnp.row_stack - to close function gap for arrays join relating use cases.

Additionally the PR includes changes to complete description of all input arguments to existing manipulation functions and to align all of them to one style.

  • 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?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you filing the PR as a draft?

@antonwolfy antonwolfy self-assigned this Dec 20, 2023
Copy link
Contributor

github-actions bot commented Dec 20, 2023

View rendered docs @ https://intelpython.github.io/dpnp/pull//index.html

dpnp/dpnp_iface_manipulation.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_manipulation.py Outdated Show resolved Hide resolved
antonwolfy and others added 2 commits December 22, 2023 09:37
Co-authored-by: vtavana <120411540+vtavana@users.noreply.github.com>
Co-authored-by: vtavana <120411540+vtavana@users.noreply.github.com>
dpnp/dpnp_iface_manipulation.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_manipulation.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_manipulation.py Outdated Show resolved Hide resolved
Input array data types are limited by supported DPNP :ref:`Data types`.
Parameters
----------
dst : {dpnp.ndarray, usm_ndarray}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as for broadcast_arrays
sequence of {dpnp.ndarray, usm_ndarray} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, because dst is an array, but not a sequence of arrays

:obj:`dpnp.hstack` : Stack arrays in sequence horizontally (column wise).
:obj:`dpnp.column_stack` : Stack 1-D arrays as columns into a 2-D array.
:obj:`dpnp.stack` : Join a sequence of arrays along a new axis.
:obj:`dpnp.block` : Assemble an nd-array from nested lists of blocks.
Copy link
Collaborator

Choose a reason for hiding this comment

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

dpnp does not have block implementation.
Is this line added for the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

:obj:`dpnp.column_stack` : Stack 1-D arrays as columns into a 2-D array.
:obj:`dpnp.stack` : Join a sequence of arrays along a new axis.
:obj:`dpnp.block` : Assemble an nd-array from nested lists of blocks.
:obj:`dpnp.dsplit` : Split array along third axis.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

Copy link
Contributor Author

@antonwolfy antonwolfy Dec 22, 2023

Choose a reason for hiding this comment

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

yep, same

@@ -1153,19 +1351,14 @@ def result_type(*arrays_and_dtypes):

Parameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

result_type(*arrays_and_dtypes) in docstings can be removed, can not it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, because it suppress a possible warning generated by flake8 here (the 1st string in the docstring must be one-lined string).
in the generated documentation the line result_type(*arrays_and_dtypes) is a signature of the function

dpnp/dpnp_iface_manipulation.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@vlad-perevezentsev vlad-perevezentsev left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks @antonwolfy

@antonwolfy antonwolfy merged commit 9e8323e into master Dec 22, 2023
45 checks passed
@antonwolfy antonwolfy deleted the missing_join_funcs branch December 22, 2023 16:33
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