-
Notifications
You must be signed in to change notification settings - Fork 53
linalg.trace should just support square inputs #359
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
Comments
The current behavior of We already expand on the definition of the trace by supporting an Accordingly, while generally I favor aligning with mathematical definitions, given the widespread support for NumPy's API, I'm in favor of leaving the spec as is. |
Since this behaviour may be achieved with Note that this does not disallow different libraries to provide extensions that support the non-square behaviour. Now, not forcing them to implement it would be great. As a side note, I'd be interested in knowing of an example where the |
This was discussed during the most recent consortium meeting (1-6-2021). Consensus there was that the existing API should remain as is given that restricting the API to square matrices and removing support for the While NumPy could introduce such changes in a dedicated In general, the specification tries to avoid introducing backward incompatible changes unless there is a very compelling reason to do so, and, in this case, mathematical purity was not a sufficiently compelling reason. Will close out... |
Specifying the function just for square inputs doesn't make the libraries do anything (let that be implement support or throw an error), right? In that case, I don't see how this proposal would incur in BC-breaking errors. |
The point was that there are already two libraries with shipped releases containing Since this is a minor issue either way, the decision to not change it anymore makes sense. If this was brought up 4 months ago, it'd be a story purely about pros and cons of a new design, now it is not. You actually reviewed |
While reviewing the implementation of
torch.linalg.trace
pytorch/pytorch#62714 (comment), we realised thatlinalg.trace
supports non-square matrices.This should not be the case. For example, the whole wikipedia page for trace always assumes that the matrix is square.
For the abstract reasons for why don't we want to support rectangular matrices I'd say that, even in its most abstract definition on symmetric monoidal categories, the trace is just defined for endomorphisms, that is, square matrices when C = Finite dimensional vector spaces.
In summary, even though we could support this, I don't think we should.
The text was updated successfully, but these errors were encountered: