-
Notifications
You must be signed in to change notification settings - Fork 488
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
Lower _linalg_svd #4537
Lower _linalg_svd #4537
Conversation
e75c513
to
255f999
Compare
CI failing due to seemingly unrelated error: |
255f999
to
f6651cb
Compare
Update: this test seems like it's failing on head. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Feel free to merge after test is green
This change lowers _linalg_svd by mostly reusing the existing svd lowering. However, there are a couple of notable differences between these two ops: 1. torch.svd()'s `some` is the opposite of torch.linalg.svd()'s `full_matrices`. Note that default value for both is True, so the default behavior is effectively the opposite. 2. torch.svd() returns V, whereas torch.linalg.svd() returns Vh (V transposed). 3. If `compute_uv` is False, torch.svd() returns zero-filled tensors for U and Vh, whereas torch.linalg.svd() returns empty tensors.
f6651cb
to
080f7c1
Compare
crashed with frame info
seems like some shape in SVD is invalid.. |
Seems like I missed an op in the |
b391a34
to
3a4deb8
Compare
Added some more ops failing due to the same existing error with Now locally, the tests are passing but I'll let the CI verify. |
* Lower _linalg_svd This change lowers _linalg_svd by mostly reusing the existing svd lowering. However, there are a couple of notable differences between these two ops: 1. torch.svd()'s `some` is the opposite of torch.linalg.svd()'s `full_matrices`. Note that default value for both is True, so the default behavior is effectively the opposite. 2. torch.svd() returns V, whereas torch.linalg.svd() returns Vh (V transposed). 3. If `compute_uv` is False, torch.svd() returns zero-filled tensors for U and Vh, whereas torch.linalg.svd() returns empty tensors. * Run linter * Disable some more tests * Add comments to the disabled tests
Fixes #4511
Lower _linalg_svd
This change lowers _linalg_svd by mostly reusing the existing svd lowering. However, there are a couple of notable differences between these two ops:
some
is the opposite of torch.linalg.svd()'sfull_matrices
. Note that default value for both is True, so the default behavior is effectively the opposite.compute_uv
is False, torch.svd() returns zero-filled tensors for U and Vh, whereas torch.linalg.svd() returns empty tensors.As a result of this change, we also disable the following ops in xla/test/test_ops.py:
geqrf
linalg.det
linalg.inv_ex
linalg.matrix_rank
linalg.svd
linalg.svdvals
These ops all call into the newly lowered
_linalg_svd
and cause failure:Slice dim size 1 greater than dynamic slice dimension: 0
. This failure seems to be also happening in our master branch for the already lowered opsvd
. In xla/test/test_ops.py, ops such assvd
,pinverse
, ornuclear_norm
that callsvd
are failing due to the same error and are disabled. However, to ensure correctness for the newly lowered_linalg_svd
, this PR adds unit tests and does not cause any regressing cpp test failures.