TensorFlow has no attribute “with_dependencies”

前端 未结 3 1199
攒了一身酷
攒了一身酷 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 12:06

    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.

提交回复
热议问题