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

Should vecdot broadcast along the contracted axis? #471

Closed
asmeurer opened this issue Aug 4, 2022 · 1 comment · Fixed by #473
Closed

Should vecdot broadcast along the contracted axis? #471

asmeurer opened this issue Aug 4, 2022 · 1 comment · Fixed by #473
Labels
bug Something isn't working.
Milestone

Comments

@asmeurer
Copy link
Member

asmeurer commented Aug 4, 2022

The spec implies that it should https://data-apis.org/array-api/latest/API_specification/generated/signatures.linear_algebra_functions.vecdot.html#signatures.linear_algebra_functions.vecdot. However, other functions like matmul do not broadcast along the contracted axis.

This came up in the numpy implementation, which is currently wrong, but is being fixed at numpy/numpy#21928.

@leofang
Copy link
Contributor

leofang commented Aug 5, 2022

tensordot does not allow broadcasting in the contracted axes, so I think vecdot shouldn't, either.

@kgryte kgryte added the bug Something isn't working. label Aug 29, 2022
@kgryte kgryte added this to the v2022 milestone Aug 29, 2022
kgryte added a commit to kgryte/array-api that referenced this issue Aug 29, 2022
This resolves data-apis#471.

The existing spec provides conflicting guidance saying both that the
axes over which to compute the dot product must be equal, while also
saying that input arrays must be broadcast compatible without
qualification, thus implying that the contracted axis could also
broadcast.

This commit explicitly defines broadcast behavior for only the
contracted axes, thus bringing vecdot inline with broadcasting
behavior in tensordot.
rgommers pushed a commit that referenced this issue Sep 5, 2022
This resolves #471.

The existing spec provides conflicting guidance saying both that the
axes over which to compute the dot product must be equal, while also
saying that input arrays must be broadcast compatible without
qualification, thus implying that the contracted axis could also
broadcast.

This commit explicitly defines broadcast behavior for only the
contracted axes, thus bringing vecdot inline with broadcasting
behavior in tensordot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants