Keras: module 'tensorflow' has no attribute 'placeholder'

Created on 1 Nov 2019  路  3Comments  路  Source: keras-team/keras

File "C:\Users\User\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 517, in placeholder
x = tf.placeholder(dtype, shape=shape, name=none)

AttributeError: module 'tensorflow' has no attribute 'placeholder'

How can I get rid of this kind of error?

tensorflow

Most helpful comment

I had the same problem. I solved it by re-installing Keras.
pip uninstall keras
conda install keras

All 3 comments

I am having the same problem. Did you solve your issue?

I had the same problem. I solved it by re-installing Keras.
pip uninstall keras
conda install keras

The issue for me was that Tensorflow 2.x does not use tf.placeholders (and tf.session()) anymore.

This guide from Tensorflow explains the changes from Tensorflow 1.x to Tensorflow 2.x and how to convert old code: https://www.tensorflow.org/guide/migrate

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harishkrishnav picture harishkrishnav  路  3Comments

amityaffliction picture amityaffliction  路  3Comments

rantsandruse picture rantsandruse  路  3Comments

kylemcdonald picture kylemcdonald  路  3Comments

NancyZxll picture NancyZxll  路  3Comments