Reputation: 55
I'm new here,recently I am learning CNN with tensorflow and keras,and I am trying to run cnn model to train mnist dataset,but After I upgraded with tnesorflow 2.0 to 2.1, I got this error message:
raise RuntimeError("tf.placeholder() is not compatible with "
RuntimeError: tf.placeholder() is not compatible with eager execution.
I try this code
tf.compat.v1.disable_eager_execution()
and next,
##build input layer
with tf.compat.v1.name_scope('Input_Layer'):
x=tf.compat.v1.placeholder("float",shape=[None, 784],name="x")
x_image = tf.compat.v1.reshape(x, [-1,28,28,1])
and below is CNN model, so I can run the model successfully,but I still want to understand why.... (before I upgraded to 2.1,I can run the model,but now I need that code...) could someone help me figure out?? Thanks..
Upvotes: 4
Views: 6291