以下のコードを入力するとエラーが出ます。どこがおかしいのか教えてください。```python
コード
import
1from tensorflow import keras 2import matplotlib.pyplot as plt 3batch_size = 128 4num_class = 10 5epochs = 20 6(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data() 7for i in range(10): 8 plt.subplot(2, 5, i+1) 9 plt.title("Label:" + str(i)) 10 plt.imshow(x_train[i].reshape(28, 28), cmap=None) 11x_train, x_test = x_train / 255.0, x_test / 255.0 12model = keras.models.Sequential([ 13 keras.layers.Flatten(), 14 keras.layers.Dense(512, activation="relu"), 15 keras.layers.Dropout(0.2), 16 keras.layers.Dense(10, activation="softmax") 17]) 18model.compile(optimizer="adam", loss="sparse_categorical_clossentropy", metrics=["accuracy"]) 19model.fit(x_train, y_train, epochs=5) 20 21エラー内容 22--------------------------------------------------------------------------- 23ValueError Traceback (most recent call last) 24<ipython-input-1-b7b249b23d96> in <module> 25 18 ]) 26 19 model.compile(optimizer="adam", loss="sparse_categorical_clossentropy", metrics=["accuracy"]) 27---> 20 model.fit(x_train, y_train, epochs=5)
回答1件
あなたの回答
tips
プレビュー