Skip to content

Return tuple instead of list from atleast_1d/2d/3d and ogrid#2965

Open
antonwolfy wants to merge 10 commits into
masterfrom
return-tuple-of-array-acc-to-numpy-2.0
Open

Return tuple instead of list from atleast_1d/2d/3d and ogrid#2965
antonwolfy wants to merge 10 commits into
masterfrom
return-tuple-of-array-acc-to-numpy-2.0

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

NumPy returns a tuple of arrays (not a list) from several functions that yield multiple arrays.
This PR aligns dpnp with that behavior.

What is done

  • dpnp.atleast_1d, dpnp.atleast_2d, dpnp.atleast_3d and dpnp.ogrid now return a tuple of arrays instead of a list. Single-input
    atleast_*d and single-slice ogrid still return a bare array, and mgrid still returns a single stacked array (matching NumPy).
  • Added/extended tests to assert the return container type matches NumPy. While here, added the same parity checks for other tuple-returning functions that lacked them (nonzero, where, ix_, tril_indices, triu_indices, unravel_index, unstack).

The split family (array_split, split, hsplit, vsplit, dsplit) and histogramdd still return lists, matching current NumPy.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an 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?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

@antonwolfy antonwolfy added this to the 0.21.0 release milestone Jun 22, 2026
@antonwolfy antonwolfy self-assigned this Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@coveralls

coveralls commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.069% (+0.003%) from 78.066% — return-tuple-of-array-acc-to-numpy-2.0 into master

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev1=py313h509198e_28 ran successfully.
Passed: 1355
Failed: 5
Skipped: 16

@ndgrigorian ndgrigorian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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