Computes the singular value decompositions of one or more matrices.
tf.raw_ops.Svd( input, compute_uv=True, full_matrices=False, name=None )
Computes the SVD of each inner matrix in input
such that input[..., :, :] = u[..., :, :] * diag(s[..., :, :]) * transpose(v[..., :, :])
# a is a tensor containing a batch of matrices. # s is a tensor of singular values for each matrix. # u is the tensor containing the left singular vectors for each matrix. # v is the tensor containing the right singular vectors for each matrix. s, u, v = svd(a) s, _, _ = svd(a, compute_uv=False)
Args | |
---|---|
input | A Tensor . Must be one of the following types: float64 , float32 , half , complex64 , complex128 . A tensor of shape [..., M, N] whose inner-most 2 dimensions form matrices of size [M, N] . Let P be the minimum of M and N . |
compute_uv | An optional bool . Defaults to True . If true, left and right singular vectors will be computed and returned in u and v , respectively. If false, u and v are not set and should never referenced. |
full_matrices | An optional bool . Defaults to False . If true, compute full-sized u and v . If false (the default), compute only the leading P singular vectors. Ignored if compute_uv is False . |
name | A name for the operation (optional). |
Returns | |
---|---|
A tuple of Tensor objects (s, u, v). | |
s | A Tensor . Has the same type as input . |
u | A Tensor . Has the same type as input . |
v | A Tensor . Has the same type as input . |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/Svd