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

Some fixes for torch.linalg wrappers #94

Merged
merged 6 commits into from
Feb 29, 2024

Conversation

asmeurer
Copy link
Member

These came up from data-apis/array-api-tests#101.

It was not properly imported, and also torch.cross does not broadcast
correctly in all cases.
- torch.vecdot incorrectly allows broadcasting in the contracted dimensions
- The 2023 version of the spec updates the language to require axis to apply
  before broadcasting, not after. The implementation for integer arguments is
  updated to follow this behavior. Note that the spec only actually requires
  axis to be negative, but we allow nonnegative axis too if x1 and x2 have the
  required number of dimensions and those dimensions have same value, which
  matches the numpy gufunc vecdot implementation and also the base
  torch.vecdot implementation as far as I can tell.
This is changed in the 2023 version of the spec, and matches the new np.vecdot
gufunc.
Also cleanup the torch.linalg __all__
@asmeurer asmeurer merged commit 74b7b79 into data-apis:main Feb 29, 2024
16 of 27 checks passed
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.

1 participant