I want to use the tf.with_dependencies
function to save the state of my RNNs. For some reason I get the following error.
Or try: from tensorflow.python.ops.control_flow_ops import with_dependencies
There is no such function in the TensorFlow API. Instead you can use with tf.control_dependencies():
and tf.identity()
to achieve the intended effect:
with tf.control_dependencies([expected_output]):
result = tf.identity(input_tensor)
tf.with_dependencies
was deprecated somewhere in the end of 2015. Nonetheless it is still defined in the tf code, it is no longer exported (no @tf_export
in front of the function) and therefore is not available.
Use
with tf.control_dependencies([expected_output]):
result = tf.identity(input_tensor)
as suggested by mrry, as it does absolutely the same thing.