Class Svd<T extends TType>

java.lang.Object
org.tensorflow.op.RawOp
org.tensorflow.op.linalg.Svd<T>
All Implemented Interfaces:
Op

@Operator(group="linalg") public final class Svd<T extends TType> extends RawOp
Computes the singular value decompositions of one or more matrices. 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)
  • Field Details

  • Constructor Details

  • Method Details

    • create

      @Endpoint(describeByClass=true) public static <T extends TType> Svd<T> create(Scope scope, Operand<T> input, Svd.Options... options)
      Factory method to create a class wrapping a new Svd operation.
      Type Parameters:
      T - data type for Svd output and operands
      Parameters:
      scope - current scope
      input - 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.
      options - carries optional attribute values
      Returns:
      a new instance of Svd
    • computeUv

      public static Svd.Options computeUv(Boolean computeUv)
      Sets the computeUv option.
      Parameters:
      computeUv - 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.
      Returns:
      this Options instance.
    • fullMatrices

      public static Svd.Options fullMatrices(Boolean fullMatrices)
      Sets the fullMatrices option.
      Parameters:
      fullMatrices - 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.
      Returns:
      this Options instance.
    • s

      public Output<T> s()
      Gets s. Singular values. Shape is [..., P].
      Returns:
      s.
    • u

      public Output<T> u()
      Gets u. Left singular vectors. If full_matrices is False then shape is [..., M, P]; if full_matrices is True then shape is [..., M, M]. Undefined if compute_uv is False.
      Returns:
      u.
    • v

      public Output<T> v()
      Gets v. Left singular vectors. If full_matrices is False then shape is [..., N, P]. If full_matrices is True then shape is [..., N, N]. Undefined if compute_uv is false.
      Returns:
      v.