为什么tensorflow和numpy的特征值输出不同?

2024-03-28 15:03:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用numpy和tensorflow计算矩阵的特征值,但我得到的每个实现的特征值都不同。以下是详细情况

A=([1,2,3],[1,2,3],[1,2,3]) 

带numpy的A的特征值是[0,6,0]

具有张量流的A的特征值是[ 0.30797836, 0.64310414, 5.04891825]

我使用tf.self_adjoint_eig实现tensorflow,使用numpy.linalg.eig实现numpy。在


Tags: selfnumpytftensorflow矩阵特征值linalg详细情况
1条回答
网友
1楼 · 发布于 2024-03-28 15:03:49

根据功能描述: https://www.tensorflow.org/versions/master/api_docs/python/math_ops.html#self_adjoint_eig

Calculates the Eigen Decomposition of a square Self-Adjoint matrix.

Only the lower-triangular part of the input will be used in this case. The upper-triangular part will not be read.

因此,你的矩阵上的TensorFlow的self_adjoint_eig等同于下面矩阵的numpy eig

({1,1,1},{1,2,2},{1,2,3})

相关问题 更多 >