nlpyang / structured

code for Learning Structured Text Representations

Home Page:https://arxiv.org/abs/1705.09207

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About tf.matrix_inverse()

szxSpark opened this issue · comments

Excuse me, do you meet the irreversibility of the matrix in neural.py line 87?It could cause error during the trainng time.
LL_inv = tf.matrix_inverse(LL) #batch_l, doc_l, doc_l

Hi Yang,
I got the following error at Line 87 of neural.py.
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input is not invertible.
[[Node: MatrixInverse_1 = MatrixInverseT=DT_FLOAT, adjoint=false, _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'MatrixInverse_1', defined at :
File "/nfs/user/public/vbalacha/structured/neural.py", line 87, in _getMatrixTree
LL_inv = tf.matrix_inverse(LL) #batch_l, doc_l, doc_l

What's the fix for this?

Have you fixed it? I also meet this problem. @szxSpark @vidhishanair

@kscp123 No. this happens only when diagonal elements are 0, which happens only for some rare initializations. Sometimes restarting fixes it.

@kscp123 No. this happens only when diagonal elements are 0, which happens only for some rare initializations. Sometimes restarting fixes it.

But in my case, the elements are not 0, however the determinant is 0. That case occurs occasionally. How to fix it?