TensorFlow has no attribute “with_dependencies”

前端 未结 3 1169
攒了一身酷
攒了一身酷 2021-01-13 11:35

I want to use the tf.with_dependencies function to save the state of my RNNs. For some reason I get the following error.



        
3条回答
  •  天涯浪人
    2021-01-13 11:54

    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)
    

提交回复
热议问题