-
Notifications
You must be signed in to change notification settings - Fork 46
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
The transpose
function is problematic
#228
Comments
I think separating the functionality of
The only real relation is that (1) can be implemented via (2). From my perspective, the functionality (1) would be the best fit for the name "transpose", and (2) could use some other name, like "permute axes". |
During the consortium meeting on 2021-07-14, the following was considered a path forward:
|
any thoughts on the name I like |
Good point @shoyer, there's also https://numpy.org/devdocs/reference/random/generated/numpy.random.Generator.permuted.html which is quite similar. I don't have a strong preference, but |
Some other reference points:
I am fine with either
In which case, to throw another hat in the ring, maybe |
|
There are multiple problems, both related to adoption due to conflicting definitions, and because NumPy's
transpose
does something no one really wants (namely, swap all axes).The current array API
transpose
may not be correct:linalg
functions.PyTorch names the
numpy.transpose
equivalentpermute
, and PyTorch'stranspose
isnp.swapaxes
. Relevant issues PyTorch issues:Relevant NumPy issues:
T
method for transposition applying to 1D vectors numpy/numpy#9530np.linalg.linalg.transpose
which is private but does have the desired behavior)There's multiple ways of dealing with this problem:
transpose
completely, and usepermute
or some other function name with the behavior we want by default (do the right thing for batches of 2-D matrices)matrix_transpose
function and a corresponding.mT
(or.MT
) attributeI searched the JAX and TensorFlow issue trackers as well and, somewhat surprisingly, didn't find an issue about this topic.
The text was updated successfully, but these errors were encountered: