可能的 tensorflow cholesky_solve 不一致?

Possible tensorflow cholesky_solve inconsistency?

我正在尝试使用 tensorflow.cholesky_solve 求解线性方程组,但我得到了一些意想不到的结果。

我写了一个脚本来比较一个非常简单的线性系统的输出与简单的矩阵求逆 tensorflow.matrix_inverse, the non-cholesky based matrix equation solver tensorflow.matrix_solvetensorflow.cholesky_solve

根据我对链接文档的理解,这三种情况都应该产生单位矩阵除以 2 的解,但 tensorflow.cholesky_solve 不是这种情况。也许我误解了文档?

import tensorflow as tf

I = tf.eye(2, dtype=tf.float32)
X = 2 * tf.eye(2, dtype=tf.float32)
X_inv = tf.matrix_inverse(X)
X_solve = tf.matrix_solve(X, I)
X_chol_solve = tf.cholesky_solve(tf.cholesky(X), I)

with tf.Session() as sess:
    for x in [X_inv, X_solve, X_chol_solve]:
        print('{}:\n{}'.format(x.name, sess.run(x)))
        print

产量输出:

MatrixInverse:0:
[[ 0.5  0. ]
 [ 0.   0.5]]

MatrixSolve:0:
[[ 0.5  0. ]
 [ 0.   0.5]]

cholesky_solve/MatrixTriangularSolve_1:0:
[[ 1.  0.]
 [ 0.  1.]]


Process finished with exit code 0

我认为这是一个错误。请注意,结果甚至不依赖于 RHS,除非 RHS = 0,在这种情况下,您会得到 nan 而不是 0。请在 GitHub.

上报告