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
Added linalg.cholesky #46083
Added linalg.cholesky #46083
Conversation
I'm not sure whether what I did in |
💊 CI failures summary and remediationsAs of commit eb507e5 (more details on the Dr. CI page):
🚧 2 ongoing upstream failures:These were probably caused by upstream breakages that are not fixed yet:
Extra GitHub checks: 1 failed
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 141 times. |
Codecov Report
@@ Coverage Diff @@
## master #46083 +/- ##
===========================================
+ Coverage 26.11% 60.81% +34.70%
===========================================
Files 437 2748 +2311
Lines 55231 254054 +198823
===========================================
+ Hits 14424 154514 +140090
- Misses 40807 99540 +58733 |
test/test_linalg.py
Outdated
from torch.testing._internal.common_utils import random_hermitian_pd_matrix | ||
A = random_hermitian_pd_matrix(shape, *batch, dtype=dtype, device=device) | ||
expected_L = np.linalg.cholesky(A.cpu().numpy()) | ||
actual_L = torch.linalg.cholesky(A) |
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.
Does this produce the aforementioned RuntimeError? If so, then I think it's probably better to use a with self.assertRaisesRegex(...):
, rather than expectedFailure
.
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.
The idea to use an xfail test (unittest.expectedFailure
) because that is a bug we can't fix right now.
I would expect to use self.assertRaisesRegex(...)
(and consequently mark the test as 'pass') for the intended errors that are not bugs.
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.
Looks good overall to me.
Does linalg.cholesky
support JIT and autograd? If so, maybe we should have a test case for it in test/test_linalg.py:test_autograd_and_jit
Hey, @mruberry, this is now ready to be merged. |
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.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@mruberry, I'm sorry there was an error that I didn't notice when updating the branch. I think this PR needs to be imported again. |
Resolved merge conflicts. |
@IvanYashchuk More merge conflicts, unfortunately. You may want to add the tests as a different place in test_linalg.py to try and avoid these conflicts. |
@mruberry, I updated the branch. |
batched complex input does not work until batched complex matmul is implemented
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.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Test failure is real: test_cholesky_autograd_xfailed_cuda_complex128 - TestLinalgCUDA |
So batched matmul for complex-valued inputs on CUDA now works. I fixed the tests. |
This part of the lint failure is real:
Sorry for the noise, the other failure is in the base. The ROCm failure appears unrelated. |
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.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This PR adds
torch.linalg.cholesky
function that matchesnumpy.linalg.cholesky
.Fixed
lda
argument tolapackCholesky
calls.Added
random_hermitian_pd_matrix
helper function for tests.Ref #42666.