Add forward mode differentiation for torch.linalg.cholesky and transpose#62159
Add forward mode differentiation for torch.linalg.cholesky and transpose#62159IvanYashchuk wants to merge 5 commits into
Conversation
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 14dcdec (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 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 to the (internal) Dr. CI Users group. |
b1b9ef6 to
72b08ba
Compare
lezcano
left a comment
There was a problem hiding this comment.
Just left a comment. The rest of the code LGTM. Nice use of triangular_solve to compute the inverse :)
| decorators=[skipCUDAIfNoMagmaAndNoCusolver, skipCUDAIfRocm, skipCPUIfNoLapack]), | ||
| decorators=[skipCUDAIfNoMagmaAndNoCusolver, skipCUDAIfRocm, skipCPUIfNoLapack], | ||
| skips=( | ||
| # Gradcheck for complex generates invalid inputs for this function |
There was a problem hiding this comment.
Might this be because it does not create Hermitian inputs? It's not clear whether we can assume that the inputs are Hermitian or not. See #62163 (comment)
There was a problem hiding this comment.
Ho yes, I encountered that one but forgot to fix it.
We should update
pytorch/torch/autograd/gradcheck.py
Line 925 in b73d759
| decorators=[skipCUDAIfNoMagmaAndNoCusolver, skipCUDAIfRocm, skipCPUIfNoLapack]), | ||
| decorators=[skipCUDAIfNoMagmaAndNoCusolver, skipCUDAIfRocm, skipCPUIfNoLapack], | ||
| skips=( | ||
| # Gradcheck for complex generates invalid inputs for this function |
There was a problem hiding this comment.
Ho yes, I encountered that one but forgot to fix it.
We should update
pytorch/torch/autograd/gradcheck.py
Line 925 in b73d759
|
|
||
| - name: transpose.int(Tensor(a) self, int dim0, int dim1) -> Tensor(a) | ||
| self: grad.transpose(dim0, dim1) | ||
| result: auto_linear |
There was a problem hiding this comment.
note that this will conflict with #59993
Not a big deal as the rebase will be simple, but we should not land them at the same time.
CI Flow Status⚛️ CI FlowRuleset - Version:
You can add a comment to the PR and tag @pytorchbot with the following commands: # ciflow rerun, "ciflow/default" will always be added automatically
@pytorchbot ciflow rerun
# ciflow rerun with additional labels "-l <ciflow/label_name>", which is equivalent to adding these labels manually and trigger the rerun
@pytorchbot ciflow rerun -l ciflow/scheduled -l ciflow/slowFor more information, please take a look at the CI Flow Wiki. |
Codecov Report
@@ Coverage Diff @@
## master #62159 +/- ##
==========================================
+ Coverage 66.63% 66.72% +0.08%
==========================================
Files 707 707
Lines 92338 92338
==========================================
+ Hits 61534 61612 +78
+ Misses 30804 30726 -78 |
|
|
|
@albanD has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
A small note: We should have a look at the performance of |
…ose (pytorch#62159) Summary: This PR adds forward mode differentiation for `torch.linalg.cholesky`, `torch.linalg.cholesky_ex`, and `transpose` functions. Complex tests for Cholesky fail because for some reason the gradcheck sends matrices full of zeros to `cholesky_jvp` function. cc ezyang albanD zou3519 gqchen pearu nikitaved soulitzer Lezcano Varal7 jianyuh mruberry heitorschueroff walterddr IvanYashchuk xwang233 Pull Request resolved: pytorch#62159 Reviewed By: mrshenli Differential Revision: D30776829 Pulled By: albanD fbshipit-source-id: 32e5539ed6423eed8c18cce16271330ab0ea8d5e
This PR adds forward mode differentiation for
torch.linalg.cholesky,torch.linalg.cholesky_ex, andtransposefunctions.Complex tests for Cholesky fail because for some reason the gradcheck sends matrices full of zeros to
cholesky_jvpfunction.cc @ezyang @albanD @zou3519 @gqchen @pearu @nikitaved @soulitzer @lezcano @Varal7 @jianyuh @mruberry @heitorschueroff @walterddr @IvanYashchuk @xwang233