tf.svd(tensor, compute_uv=True, full_matrices=False, name=None)
Computes the singular value decompositions of one or more matrices.
Computes the SVD of each inner matrix in tensor
such that tensor[..., :, :] = u[..., :, :] * diag(s[..., :, :]) * transpose(v[..., :,
:])
# a is a tensor. # s is a tensor of singular values. # u is a tensor of left singular vectors. # v is a tensor of right singular vectors. s, u, v = svd(a) s = svd(a, compute_uv=False)
Args:
-
matrix
:Tensor
of shape[..., M, N]
. LetP
be the minimum ofM
andN
. -
compute_uv
: IfTrue
then left and right singular vectors will be computed and returned inu
andv
, respectively. Otherwise, only the singular values will be computed, which can be significantly faster. -
full_matrices
: If true, compute full-sizedu
andv
. If false (the default), compute only the leadingP
singular vectors. Ignored ifcompute_uv
isFalse
. -
name
: string, optional name of the operation.
Returns:
-
s
: Singular values. Shape is[..., P]
. -
u
: Right singular vectors. Iffull_matrices
isFalse
(default) then shape is[..., M, P]
; iffull_matrices
isTrue
then shape is[..., M, M]
. Not returned ifcompute_uv
isFalse
. -
v
: Left singular vectors. Iffull_matrices
isFalse
(default) then shape is[..., N, P]
. Iffull_matrices
isTrue
then shape is[..., N, N]
. Not returned ifcompute_uv
isFalse
.
Please login to continue.