Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.svd function

PyTorch torch.svd function


PyTorch torch reference manual PyTorch torch reference manual

torch.svd is a function in PyTorch used to compute the singular value decomposition of a matrix.

Function definition

torch.svd(input, some, compute_uv, out)


Usage examples

Example

import

torch

A

=

torch.

randn

(

3

,

4

)

SVD decomposition

U

,

S

,

V

=

torch.

svd

(

A

)

print

(

"U shape:"

,

U.

shape

)

print

(

"S shape:"

,

S.

shape

)

print

(

"V shape:"

,

V.

shape

)

The output is:

U 形状: torch.Size([3, 3])

S 形状: torch.Size([3])

V 形状: torch.Size([4, 4])


PyTorch torch reference manual PyTorch torch reference manual