Skip to content

Align dpnp.tensor.expand_dims with Python array API 2025.12#2988

Open
antonwolfy wants to merge 7 commits into
masterfrom
align-tensor.expand_dims-with-array-api-2025.12
Open

Align dpnp.tensor.expand_dims with Python array API 2025.12#2988
antonwolfy wants to merge 7 commits into
masterfrom
align-tensor.expand_dims-with-array-api-2025.12

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This PR aligns dpnp.tensor.expand_dims with the Python array API specification (revision 2025.12), which defines the signature as expand_dims(x, /, axis)axis is a required positional-or-keyword argument with no default.

Previously the tensor-level function used expand_dims(X, /, *, axis=0) (axis keyword-only with a default of 0), which did not match the standard.
The public dpnp.expand_dims wrapper is also made positional-only for its array argument ((a, /, axis)), consistent with sibling array-API functions in the same module (squeeze, reshape, broadcast_to, stack).

The function body was already multi-axis capable; this change updates the signature and documentation to match, and closes gaps in test coverage.

  • 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 Jul 2, 2026
@antonwolfy antonwolfy self-assigned this Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.11%. remained the same — align-tensor.expand_dims-with-array-api-2025.12 into master

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev2=py313h509198e_17 ran successfully.
Passed: 1372
Failed: 3
Skipped: 5

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.

2 participants