Skip to content

Conversation

@vishwakftw
Copy link
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.

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
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
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
Contributor Author

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

@vishwakftw
Copy link
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
Contributor Author

Build failures are unrelated.

Copy link
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
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.

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