Skip to content

Added OpInfo-based testing of some linalg functions#51107

Closed
IvanYashchuk wants to merge 33 commits intopytorch:masterfrom
IvanYashchuk:linalg-opinfo-tests
Closed

Added OpInfo-based testing of some linalg functions#51107
IvanYashchuk wants to merge 33 commits intopytorch:masterfrom
IvanYashchuk:linalg-opinfo-tests

Conversation

@IvanYashchuk
Copy link
Copy Markdown
Collaborator

Added OpInfo-based testing of the following linear algebra functions:

  • cholesky, linalg.cholesky
  • linalg.eigh
  • inverse, linalg.inv
  • qr, linalg.qr
  • solve

The output of torch.linalg.pinv for empty inputs was not differentiable, now it's fixed.

In some cases, batched grad checks are disabled because it doesn't work well with 0x0 matrices (see #50743 (comment)).

Ref. #50006

@IvanYashchuk IvanYashchuk added module: tests Issues related to tests (not the torch.testing module) module: linear algebra Issues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmul labels Jan 26, 2021
@IvanYashchuk IvanYashchuk requested a review from mruberry January 26, 2021 11:36
@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Jan 26, 2021

💊 CI failures summary and remediations

As of commit 558d744 (more details on the Dr. CI page):


  • 1/3 failures possibly* introduced in this PR
    • 1/1 non-scanned failure(s)
  • 2/3 broken upstream at merge base fe08671 on Mar 12 from 2:49am to 4:28pm

🚧 2 fixed upstream failures:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

If your commit is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

ci.pytorch.org: 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 to the (internal) Dr. CI Users group.

@IvanYashchuk
Copy link
Copy Markdown
Collaborator Author

Tests for QR decomposition are quite slow

========================================================= slowest 20 durations =========================================================
32.76s call     test/test_ops.py::TestGradientsCUDA::test_fn_grad_qr_cuda_complex128
32.08s call     test/test_ops.py::TestGradientsCUDA::test_fn_grad_linalg_qr_cuda_complex128
16.98s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_qr_cuda_float64
15.77s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_solve_cuda_complex64
15.09s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_solve_cuda_complex128
14.89s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_qr_cuda_float32
13.98s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_solve_cuda_float32
13.53s call     test/test_ops.py::TestGradientsCUDA::test_fn_gradgrad_flip_cuda_complex128
13.19s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_qr_cuda_complex64
13.05s call     test/test_ops.py::TestGradientsCUDA::test_fn_grad_svd_cuda_complex128
13.04s call     test/test_ops.py::TestGradientsCUDA::test_fn_grad_linalg_svd_cuda_complex128
12.51s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_svd_cuda_float64
11.87s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_qr_cuda_complex128
10.38s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_linalg_solve_cuda_float32
10.06s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_linalg_solve_cuda_complex64
9.71s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_linalg_solve_cuda_complex128
9.08s call     test/test_ops.py::TestGradientsCUDA::test_fn_grad_qr_cuda_float64
9.05s call     test/test_ops.py::TestGradientsCUDA::test_fn_grad_linalg_qr_cuda_float64
8.80s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_linalg_qr_cuda_float64
8.68s call     test/test_ops.py::TestCommonCUDA::test_variant_consistency_jit_svd_cuda_float32
===================================== 5139 passed, 1009 skipped, 61 warnings in 1069.53s (0:17:49) =====================================

@IvanYashchuk
Copy link
Copy Markdown
Collaborator Author

The failing tests should be fixed after merging #51109.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 2, 2021

Codecov Report

Merging #51107 (8c68fd5) into master (aeb3e93) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #51107      +/-   ##
==========================================
+ Coverage   77.29%   77.30%   +0.01%     
==========================================
  Files        1888     1888              
  Lines      183512   183613     +101     
==========================================
+ Hits       141852   141951      +99     
- Misses      41660    41662       +2     

op=torch.solve,
dtypes=floating_and_complex_types(),
test_inplace_grad=False,
# TODO: TypeError: empty_like(): argument 'input' (position 1) must be Tensor, not torch.return_types.solve
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I appreciate this TODO but this is more a failure of our out= testing (which we should be updating soonish) and not an issue with torch.solve().

Copy link
Copy Markdown
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Awesome! Nice work, @IvanYashchuk. I really appreciate how thorough and consistent you were with documentation. It makes the code much more readable and easier to maintain.

This needs a rebase. Just ping me when it's ready to merge.

@IvanYashchuk
Copy link
Copy Markdown
Collaborator Author

@mruberry I updated and rebased this PR. It's ready to merge.

@mruberry
Copy link
Copy Markdown
Collaborator

mruberry commented Mar 3, 2021

The ROCm test failures on this PR are interesting and linalg related. Would you take a look at them before we merge this?

@IvanYashchuk
Copy link
Copy Markdown
Collaborator Author

It was my fault not being careful enough when resolving the merge conflict and I accidentally removed skipCUDAIfRocm for logdet. Let's wait for CI now.

@IvanYashchuk
Copy link
Copy Markdown
Collaborator Author

@mruberry I updated this pull request with the recent changes for "out" testing. I also added all relevant ROCm skips, which will be fixed sometime later. Could you take a look once again and hopefully merge this?

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.

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

@mruberry
Copy link
Copy Markdown
Collaborator

I'll try to get this landed ASAP. I was concerned about the ROCm failure because it's a timeout, but that test build doesn't appear to be running these tests. The overall test time seems similar to current CI timings.

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.

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@mruberry merged this pull request in 7df176b.

xsacha pushed a commit to xsacha/pytorch that referenced this pull request Mar 31, 2021
Summary:
Added OpInfo-based testing of the following linear algebra functions:
* cholesky, linalg.cholesky
* linalg.eigh
* inverse, linalg.inv
* qr, linalg.qr
* solve

The output of `torch.linalg.pinv` for empty inputs was not differentiable, now it's fixed.

In some cases, batched grad checks are disabled because it doesn't work well with 0x0 matrices (see pytorch#50743 (comment)).

Ref. pytorch#50006

Pull Request resolved: pytorch#51107

Reviewed By: albanD

Differential Revision: D27006115

Pulled By: mruberry

fbshipit-source-id: 3c1d00e3d506948da25d612fb114e6d4a478c5b1
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Added OpInfo-based testing of the following linear algebra functions:
* cholesky, linalg.cholesky
* linalg.eigh
* inverse, linalg.inv
* qr, linalg.qr
* solve

The output of `torch.linalg.pinv` for empty inputs was not differentiable, now it's fixed.

In some cases, batched grad checks are disabled because it doesn't work well with 0x0 matrices (see pytorch#50743 (comment)).

Ref. pytorch#50006

Pull Request resolved: pytorch#51107

Reviewed By: albanD

Differential Revision: D27006115

Pulled By: mruberry

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

Labels

cla signed Merged module: linear algebra Issues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmul module: tests Issues related to tests (not the torch.testing module) open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants