I want to check some values of my Keras tensor. I tried to use backend.print_tensor
.
I have changed my package code of Keras, and I changed the code tf.Print
-> tf.print
.
x = Dozat(21)(x) # custom Lambda layer
x = backend.print_tensor(x)
print('x : ', x, '\n\n\n')
This message occurred.
WARNING:
Print (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2018-08-20.
Instructions for updating:
Use tf.print instead of tf.Print. Note that tf.print returns a no-output operator that directly prints the output. Outside of defuns or eager mode, this operator will not be executed unless it is directly specified in session.run or used as a control dependency for other operators. This is only a concern in graph mode. Below is an example of how to ensure tf.print executes in graph mode:
sess = tf.Session()
with sess.as_default():
tensor = tf.range(10)
print_op = tf.print(tensor)
with tf.control_dependencies([print_op]):
out = tf.add(tensor, tensor)
sess.run(out)