How do I disable TensorFlow's eager execution?

后端 未结 4 1861
無奈伤痛
無奈伤痛 2020-12-02 16:47

I am trying to learn TensorFlow. Currently, I am working with placeholders. When I tried to create the placeholder, I got an error: RuntimeError: tf.placeholder() is n

4条回答
  •  有刺的猬
    2020-12-02 17:19

    Assume you are using Tensorflow 2.0 preview release which has eager execution enabled by default. There is a disable_eager_execution() in v1 API, which you can put in the front of your code like:

    import tensorflow as tf
    
    tf.compat.v1.disable_eager_execution()
    

    On the other hand, if you are not using 2.0 preview, please check if you accidentally enabled eager execution somewhere.

提交回复
热议问题