Open
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.