-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
API changeChanges to existing functions or objects in the API.Changes to existing functions or objects in the API.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.status: BlockedIssue or pull request which is current blocked.Issue or pull request which is current blocked.topic: Linear AlgebraLinear algebra.Linear algebra.
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.outer
which 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.
lezcano, khushi-411 and NeilGirdhar
Metadata
Metadata
Assignees
Labels
API changeChanges to existing functions or objects in the API.Changes to existing functions or objects in the API.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.status: BlockedIssue or pull request which is current blocked.Issue or pull request which is current blocked.topic: Linear AlgebraLinear algebra.Linear algebra.