Fonction torch.svd de PyTorch


Pytorch torch 参考手册Manuel de référence PyTorch torch

torch.svdC'est une fonction de PyTorch utilisée pour calculer la décomposition en valeurs singulières d'une matrice.

Définition de fonction

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

Exemple d'utilisation

Exemple

import torch

A = torch.randn(3, 4)

# Décomposition SVD
U, S, V = torch.svd(A)

print("Forme de U :", U.shape)
print("Forme de S :", S.shape)
print("Forme de V :", V.shape)

La sortie est :

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

Pytorch torch 参考手册Manuel de référence PyTorch torch

Autres extensions