Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to initialize matrix as identity matrix with TensorFlow
>>> mat1 = tf.diag(tf.ones((1,3)))
>>> print(mat1.eval())
[[[[ 1. 0. 0.]]
[[ 0. 1. 0.]]
[[ 0. 0. 1.]]]]
@lorenlugosch

This comment has been minimized.

lorenlugosch commented Jan 30, 2017

nice, thanks for this!

@NiziL

This comment has been minimized.

NiziL commented Apr 3, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment