Table of Contents
Shortcuts

# torch.linalg.svdvals

torch.linalg.svdvals(A, *, driver=None, out=None) → Tensor

  Computes the singular values of a matrix.

  Supports input of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if `A` is a batch of matrices then the output has the same batch dimensions.

  The singular values are returned in descending order.

  Note

  This function is equivalent to NumPy’s linalg.svd(A, compute_uv=False).

  Note

  When inputs are on a CUDA device, this function synchronizes that device with the CPU.

  See also

  `torch.linalg.svd()` computes the full singular value decomposition.

  Parameters:

    A (Tensor) – tensor of shape (*, m, n) where * is zero or more batch dimensions.

  Keyword Arguments:

    - driver (str, optional) – name of the cuSOLVER method to be used. This keyword argument only works on CUDA inputs. Available options are: None, gesvd, gesvdj, and gesvda. Check `torch.linalg.svd()` for details. Default: None.

    - out (Tensor, optional) – output tensor. Ignored if None. Default: None.

  Returns:

    A real-valued tensor, even when `A` is complex.

  Examples:

      >>> A = torch.randn(5, 3)
      >>> S = torch.linalg.svdvals(A)
      >>> S
      tensor([2.5139, 2.1087, 1.1066])

      >>> torch.dist(S, torch.linalg.svd(A, full_matrices=False).S)
      tensor(2.4576e-07)

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.