tf.eye

Construct an identity matrix, or a batch of matrices.

Used in the notebooks

Used in the guide Used in the tutorials

See also tf.ones, tf.zeros, tf.fill, tf.one_hot.

# Construct one identity matrix.
tf.eye(2)
==> [[1., 0.],
     [0., 1.]]

# Construct a batch of 3 identity matrices, each 2 x 2.
# batch_identity[i, :, :] is