AttributeError: module 'tensorflow' has no attribute 'placeholder'
Following code is failing for me and have shared TF version summary also. Is this module not compatible with tensorflow-gpu 2.0.0b1 ?
from classification_models.keras import Classifiers ResNet18, preprocess_input = Classifiers.get('resnet18')
!pip list | grep tensorflow
n_classes = 100
build model
base_model = ResNet18(input_shape=(32,32,3), weights='imagenet', include_top=False) x = keras.layers.GlobalAveragePooling2D()(base_model.output) output = keras.layers.Dense(n_classes, activation='softmax')(x) model = keras.models.Model(inputs=[base_model.input], outputs=[output])
train
model.compile(optimizer='SGD', loss='categorical_crossentropy', metrics=['accuracy']) model.summary()
model.fit(X, y)
############ Error Details #############
mesh-tensorflow 0.0.5
tensorflow 1.14.0
tensorflow-estimator 1.14.0
tensorflow-gpu 2.0.0b1
tensorflow-hub 0.6.0
tensorflow-metadata 0.14.0
tensorflow-probability 0.7.0
AttributeError Traceback (most recent call last)
6 frames /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in placeholder(shape, ndim, dtype, sparse, name) 539 x = tf.sparse_placeholder(dtype, shape=shape, name=name) 540 else: --> 541 x = tf.placeholder(dtype, shape=shape, name=name) 542 x._keras_shape = shape 543 x._uses_learning_phase = False
AttributeError: module 'tensorflow' has no attribute 'placeholder'
My tensorflow version are as follows..
mesh-tensorflow 0.0.5
tensorflow 1.14.0
tensorflow-estimator 1.14.0
tensorflow-gpu 2.0.0b1
tensorflow-hub 0.6.0
tensorflow-metadata 0.14.0
tensorflow-probability 0.7.0
'2.0.0-beta1'