I have been using the introductory example of matrix multiplication in TensorFlow.
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
produ
I didn't find it easy to understand what is required even after reading all the answers until I executed this. TensofFlow is new to me too.
def printtest():
x = tf.constant([1.0, 3.0])
x = tf.Print(x,[x],message="Test")
init = (tf.global_variables_initializer(), tf.local_variables_initializer())
b = tf.add(x, x)
with tf.Session() as sess:
sess.run(init)
print(sess.run(b))
sess.close()
But still you may need the value returned by executing the session.
def printtest():
x = tf.constant([100.0])
x = tf.Print(x,[x],message="Test")
init = (tf.global_variables_initializer(), tf.local_variables_initializer())
b = tf.add(x, x)
with tf.Session() as sess:
sess.run(init)
c = sess.run(b)
print(c)
sess.close()