Skip to content

[Ready] Batched cholesky decomposition#14017

Closed
vishwakftw wants to merge 3 commits intopytorch:masterfrom
vishwakftw:batch_cholesky
Closed

[Ready] Batched cholesky decomposition#14017
vishwakftw wants to merge 3 commits intopytorch:masterfrom
vishwakftw:batch_cholesky

Conversation

@vishwakftw
Copy link
Copy Markdown
Contributor

@vishwakftw vishwakftw commented Nov 15, 2018

Implements batching for the Cholesky decomposition.

Performance could be improved with a dedicated batched tril and triu op, which is also impeding autograd operations.

Changes made:

  • batching code
  • tests in test_torch.py, test_cuda.py and test_autograd.py.
  • doc string modification
  • autograd modification
  • removal of _batch_potrf in MultivariateNormal.

Comment thread test/test_cuda.py Outdated

This comment was marked as off-topic.

@vishwakftw vishwakftw changed the title [WIP] Batched cholesky decomposition [Ready] Batched cholesky decomposition Nov 15, 2018

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit, thank you!

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@vishwakftw
Copy link
Copy Markdown
Contributor Author

@ezyang I have addressed comments and resolved merge conflicts too.

@vishwakftw
Copy link
Copy Markdown
Contributor Author

@pytorchbot retest this please

- #else out sections that will not be reached
- Add detailed comment about using batched triu / tril and the resulting simplification
@vishwakftw
Copy link
Copy Markdown
Contributor Author

Build failures are unrelated.

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Nov 17, 2018
Summary:
Implements batching for the Cholesky decomposition.

Performance could be improved with a dedicated batched `tril` and `triu` op, which is also impeding autograd operations.

Changes made:
- batching code
- tests in `test_torch.py`, `test_cuda.py` and `test_autograd.py`.
- doc string modification
- autograd modification
- removal of `_batch_potrf` in `MultivariateNormal`.
Pull Request resolved: pytorch/pytorch#14017

Differential Revision: D13087945

Pulled By: ezyang

fbshipit-source-id: 2386db887140295475ffc247742d5e9562a42f6e
Comment thread test/test_torch.py
A = cast(random_symmetric_pd_matrix(n, *batch_dims))
cholesky_exp = torch.stack([m.cholesky(upper=upper) for m in A.reshape(-1, n, n)])
cholesky_exp = cholesky_exp.reshape_as(A)
print(torch.cholesky(A, upper=upper))

This comment was marked as off-topic.

This comment was marked as off-topic.

@vishwakftw vishwakftw deleted the batch_cholesky branch November 18, 2018 01:56
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Implements batching for the Cholesky decomposition.

Performance could be improved with a dedicated batched `tril` and `triu` op, which is also impeding autograd operations.

Changes made:
- batching code
- tests in `test_torch.py`, `test_cuda.py` and `test_autograd.py`.
- doc string modification
- autograd modification
- removal of `_batch_potrf` in `MultivariateNormal`.
Pull Request resolved: pytorch#14017

Differential Revision: D13087945

Pulled By: ezyang

fbshipit-source-id: 2386db887140295475ffc247742d5e9562a42f6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants