from keras.models import Sequential
from keras.layers import Input, Dense, Activation, Conv2D, MaxPooling2D, Flatten
from keras.datasets import mnist
报错:
from keras.models import Sequential ModuleNotFoundError: No module named 'keras'
代码修改为
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Input, Dense, Activation, Conv2D, MaxPooling2D, Flatten
from tensorflow.keras.datasets import mnist
from tensorflow.keras.utils import np_utils
报错
ImportError: cannot import name 'np_utils' from 'tensorflow.keras.utils'
代码修改为
from tensorflow.python.keras.utils.np_utils import to_categorical