In my Tensorflow graph, I would like to invert a matrix if it is invertible do something with it. If it is not invertible, the, I'd like to do something else.
I could not find any way to check if the matrix is invertible in order to do something like :
is_invertible = tf.is_invertible(mat)
tf.cond(is_invertible, f1, f2)
Is there such a thing as an is_invertible
function in Tensorflow ?
I also considered using the fact that Tensorflow raises (not each time though) an InvalidArgumentError
when I try to invert a non-nvertible matrix, but I couldn't take advantage of this.