RFC: `linalg.outer` support batches of vectors
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- numpy, pytorch
- Domain
- api
Research direction
Start with the linked linalg.outer specification and review the PyTorch and NumPy behavior cited in the issue, then read the discussion in pytorch/pytorch#63293. Done means the Array API community has agreed on batched-input semantics and updated the linalg.outer specification accordingly.
Written by the indexing model from the issue text.
Description
Current Status
Current API spec defines the linalg.outer behaviour for one-dimensional vector inputs only.
Quoting from the docs.
Computes the outer product of two vectors x1 and x2 .
Parameters
- x1 :
- first one-dimensional input array of size N . Should have a numeric data type.
- x2 :
- second one-dimensional input array of size M . Should have a numeric data type.
Proposal
Most of the array/tensor libraries involve the manipulation and usage of batched vectors. It would be worth considering batch support in linalg.outer for the Array API standard, instead of only the 1D Vectors. This will also make linalg.outer more in line with the behaviour offered by other linalg functions in the spec which generally take in an nd-array/tensor.
Interestingly
- PyTorch currently has
torch.outerwhich also only supports 1d Tensors. - NumPy though supports nd-arrays with
numpy.outer, but the behaviour is to flatten the inputs to 1d Vectors in case the input is not already 1-dimensional.
This was initially discussed in pytorch/pytorch#63293.
cc @Lezcano @rgommers
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in data-apis/array-api
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100