pytorch
ddf26816 - Make torch.svd return V, not V.conj() for complex inputs (#51012)

Commit
3 years ago
Make torch.svd return V, not V.conj() for complex inputs (#51012) Summary: **BC-breaking note:** torch.svd() added support for complex inputs in PyTorch 1.7, but was not documented as doing so. The complex "V" tensor returned was actually the complex conjugate of what's expected. This PR fixes the discrepancy. This will silently break all users of torch.svd() with complex inputs. **Original PR Summary:** This PR resolves https://github.com/pytorch/pytorch/issues/45821. The problem was that when introducing the support of complex inputs for `torch.svd` it was overlooked that LAPACK/MAGMA returns the conjugate transpose of V matrix, not just the transpose of V. So `torch.svd` was silently returning U, S, V.conj() instead of U, S, V. Behavior of `torch.linalg.pinv`, `torch.pinverse` and `torch.linalg.svd` (they depend on `torch.svd`) is not changed in this PR. Pull Request resolved: https://github.com/pytorch/pytorch/pull/51012 Reviewed By: bdhirsh Differential Revision: D26047593 Pulled By: albanD fbshipit-source-id: d1e08dbc3aab9ce1150a95806ef3b5da98b5d3ca
Author
Parents
  • aten/src/ATen/native
    • File
      BatchLinearAlgebra.cpp
    • File
      LinearAlgebra.cpp
    • cuda
      • File
        BatchLinearAlgebra.cu
      • File
        BatchLinearAlgebraLib.cu
  • test
    • File
      test_linalg.py
  • torch
    • File
      _torch_docs.py
    • csrc/autograd
      • File
        FunctionsManual.cpp
    • testing/_internal
      • File
        common_methods_invocations.py