I would like to have an example illustrating the use of the function tf.control_dependencies
. For example, I want to create two tensors X
and Y
and if they are equal do or print something.
import tensorflow as tf
session = tf.Session()
X = tf.constant(5)
Y = tf.constant(50)
with tf.control_dependencies([tf.assert_equal(X, Y)]):
print('X and Y are equal!')
In the code above, X
is clearly not equal to Y
. What is tf.control_dependencies
doing in this case?