votes up 1

svd gradient is not implemented for abs(m - n) > 1 when full_matrices is True

Exception Class:

Raise code

e_adjoint = True
    m, n = n, m
    u, v = v, u
    grad_u, grad_v = grad_v, grad_u

  with ops.control_dependencies([grad_s, grad_u, grad_v]):
    if full_matrices and abs(m - n) > 1:
      raise NotImplementedError(
          "svd gradient is not implemented for abs(m - n) > 1 "
          "when full_matrices is True")
    s_mat = array_ops.matrix_diag(s)
    s2 = math_ops.square(s)

    # NOTICE: Because of the term involving f, the gradient becomes
    # infinite (or NaN in practice) when singular values are not unique.
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 14th August 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

Ways to fix

votes up 1 votes down

#Inefficient but running: use A^T A, AA^T and tf.linalg.eig.

import tensorflow as tf
AAT = tf.matmul(A, tf.transpose(A))
ATA = tf.matmul(tf.transpose(A), A)
_, U = tf.transpose(tf.linalg.eig(AAT))
_, V = tf.linalg.eig(ATA)
Jul 01, 2022 dankanddong answer

Add a possible fix

Please authorize to post fix