Home > other >  [DeepLearning] AttributeError: module 'keras. Backend' has no attribute 'eager'
[DeepLearning] AttributeError: module 'keras. Backend' has no attribute 'eager'

Time:10-02

To run a DL TensorBoard sample error after
This is the sample code:
 import keras 
The from keras import the layers
The from keras. Datasets import imdb
The from keras. Preprocessing import sequence

Max_features=2000
Max_len=500
(x_train y_train), (x_test, y_test)=imdb. Load_data (num_words=max_features)
X_train=sequence. Pad_sequences (x_train, maxlen=max_len)
X_test=sequence. Pad_sequences (x_test, maxlen=max_len)
The model=keras. Models. Sequential ()
Model. The add (the layers. Embedding (max_features, 128,
Input_length=max_len,
Name='embed'))
Model. The add (the layers. Conv1D (32, 7, activation='relu'))
Model. The add (the layers. MaxPooling1D (5))
Model. The add (the layers. Conv1D (32, 7, activation='relu'))
Model. The add (the layers. GlobalMaxPooling1D ())
Model. The add (the layers. The Dense (1))
Model. The summary ()
Model.com from running (optimizer='rmsprop',
='binary_crossentropy' loss,
The metrics=[' acc '])
Callbacks=[
Keras. Callbacks. TensorBoard (
Log_dir='my_log_dir',
Histogram_freq=1,
Embeddings_freq=1,
# embeddings_data=https://bbs.csdn.net/topics/x_train.astype (float)
)
]
History=the model fit (x_train y_train,
Epochs=20,
Batch_size=128,

validation_split=0.2,Callbacks=callbacks)
# tensorboard -- logdir=my_log_dir


This is the run-time error:
 Using TensorFlow backend. 
Traceback (the most recent call last) :
The File "D:/PycharmProjects ML_Py/com/certone/08 practices/tensorboard py", line 1, the in & lt; module>
The import keras
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ keras \ set py", line 3, the in & lt; module>
From the import utils
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ keras \ utils \ set py", line 6, the in & lt; module>
From the import conv_utils
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ keras \ utils \ conv_utils py", line 9, the in & lt; module>
The from.. The import backend as K
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages, keras, backend, set py", line 1, the in & lt; module>
From the load_backend import epsilon
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ keras \ backend \ load_backend py", line 90, in & lt; module>
From the tensorflow_backend import *
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ keras \ backend \ tensorflow_backend py", line 5, in & lt; module>
The import tensorflow as tf
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ tensorflow \ set py", line 101, in & lt; module>
The from tensorflow_core import *
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ tensorflow_core \ set py", line 46, the in & lt; module>
From the _api. V2 import compat
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 set py", 39, the line in & lt; module>
From the import v1
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 v1 \ set py", line 32, in & lt; module>
From the import compat
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 v1 \ compat \ set py", 39, line in & lt; module>
From the import v1
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 v1/compat/v1/set py", line 29, in & lt; module>
The from tensorflow._api.v2.com pat. V1 import app
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 set py", 39, the line in & lt; module>
From the import v1
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 v1 \ set py", line 32, in & lt; module>
From the import compat
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 v1 \ compat \ set py", line 40, in & lt; module>
From the import v2
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ compat \ \ tensorflow_core \ _api \ v2 v1 \ \ compat \ v2 set py", 30, the line in & lt; module>
From tensorflow._api.v2.com. Pat v2 import audio
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ tensorflow_core \ \ compat _api \ v2, v2, set py", line 33, in & lt; module>
From the import compat
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ tensorflow_core \ _api \ v2 \ compat \ \ compat \ v2 set py", line 40, in & lt; module>
From the import v2
File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages \ \ compat tensorflow_core \ _api \ v2, v2 \ compat, v2, set py", line 320, in & lt; module>
The from tensorboard. Summary. _tf import summary
The File "D: \ PycharmProjects \ ML_Py \ com \ certone \ 08 practices \ tensorboard py", line 2, the in & lt; module>
The from keras import the layers
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages, keras, the layers, set py", line 4, the in & lt; module>
The from.. Engine. Base_layer import Layer
The File "D: \ \ Program Files \ Anaconda3 \ lib \ site - packages, keras, engine, set py", line 3, the in & lt; module>
From the input_layer import Input
nullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related