Repository navigation
Deprecate dpnp.dot when a.ndim >= 2 and b.ndim > 2 - #3124
Open
antonwolfy wants to merge 1 commit into
Open
antonwolfy wants to merge 1 commit into
antonwolfy wants to merge 1 commit into
Conversation
`dpnp.dot` and `dpnp.ndarray.dot` place the leading dimensions of `b` in the middle of the result for such inputs. Emit a `DeprecationWarning` pointing to `dpnp.tensordot(a, b, axes=(-1, -2))`, aligning with NumPy 2.6. The implementation moves into a private `_dot` shared by the function and the method, so the warning points to the user's call for both.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
October 25, 2026 11:42
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3124/index.html |
Collaborator
ndgrigorian
approved these changes
Oct 26, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For inputs where
ahas 2 or more dimensions andbhas more than 2 dimensions,dpnp.dotanddpnp.ndarray.dotplace the leading dimensions ofbin the middle of the result, unlikedpnp.matmul. NumPy 2.6 deprecates this case, and this PR mirrors that deprecation.The result is unchanged, but the call now emits:
Only that case warns. 0-D, 1-D and 2-D inputs, a 1-D
awith an N-Db, and an N-Dawith a 1-D or 2-Dbbehave as before. As in NumPy, the warning comes after shape validation, so a shape mismatch raisesValueErrorwithout a warning.The implementation moves into a private
_dot, which bothdpnp.dotanddpnp.ndarray.dotcall directly. This way the warning points to the user's line for the method as well; otherwise it would be attributed todpnp_array.py, and Python's default warning filters would hide it.The
dpnp.dotdocstring gets a "Warnings" section, and the 4-D example is removed.