上QQ阅读APP看书,第一时间看更新
Identity matrix
An identity matrix is a matrix I that does not change any vector, like V, when multiplied by I.
The following example shows how to get the identity matrix for a given size:
import tensorflow as tf
identity = tf.eye(3, 3)
with tf.Session() as sess:
print(sess.run(identity))
The output of this is shown as follows:
[[ 1. 0. 0.] [ 0. 1. 0.] [ 0. 0. 1.]]