在书面代码下面,
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import MaxPooling2D
from keras.layers import backend as k
batch_size = 128
num_classes = 10
epochs = 12
及以下问题,
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-d1183f2cea73> in <module>
8 from tensorflow.keras.layers import Conv2D
9 from tensorflow.keras.layers import MaxPooling2D
---> 10 from keras.layers import backend as k
11
12
ImportError: cannot import name 'backend'
需要帮助解决此问题
注意:我使用的是Python 3.6.0。
3条答案
按热度按时间gopyfrb31#
您可以使用keras后端库
或者直接从TensorFlow
0pizxfdo2#
尝试卸载Tensor Flow和keras,并在站点包中删除它们的目录,然后重新安装它们。
t8e9dugd3#
pip install qiskit==0.31.0
试试这个。