I am trying to run a code using keras. The program uses from keras.backend.tensorflow_backend import set_session
and i am getting an underhanded Exception thats says No module named 'keras.backend.tensorflow_backend'; 'keras.backend' is not a package with the following error code File "c:/Users/phili/Desktop/python-projects/test.py", line 15, in <module> from keras.backend.tensorflow_backend import set_session ModuleNotFoundError: No module named 'keras.backend.tensorflow_backend'; 'keras.backend' is not a package
File "c:/Users/phili/Desktop/python-projects/test.py", line 15, in <module> from keras.backend.tensorflow_backend import set_session ModuleNotFoundError: No module named 'keras.backend.tensorflow_backend'; 'keras.backend' is not a package
I am using python 3.7 Keras 2.4.3 and tensorflow 2.2.0, is there any solution to the problem i can provide the whole code if needed Thanks in advance
I guess you are importing
it incorrectly.
The command to import set_session
, for Tensorflow 2.3
(latest version) is shown below.
from tensorflow.compat.v1.keras.backend import set_session
Please find this Colab for working code.
Please refer this Tensorflow Documentation for more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.