Skip to content

Instantly share code, notes, and snippets.

@pradeepbn
Last active April 28, 2018 09:12
Show Gist options
  • Save pradeepbn/ee640c7d2a1fedc6999ae88c28f41e48 to your computer and use it in GitHub Desktop.
Save pradeepbn/ee640c7d2a1fedc6999ae88c28f41e48 to your computer and use it in GitHub Desktop.
Example to show how to use tf.Print and tfdbg
import tensorflow as tf
from tensorflow.python import debug as tf_debug
a = tf.constant([1.0, 4.0], shape=[2,1])
b = tf.constant([2.0, 3.0], shape=[1,2])
c = tf.add(tf.matmul(a,b), tf.constant([5.0, 6.0]))
d = tf.Print(c, [c, 2.0], message="Value of C is:")
sess = tf_debug.LocalCLIDebugWrapperSession(sess)
with tf.Session() as sess:
sess.run(d)
@kuldeepluvani
Copy link

to print the value of d...use below command after running session.

print(d.eval())

it will show you a resultant value of multiplication and addition operation.

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