pull down to refresh

import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers
mnist = keras.datasets.mnist (train_images, train_labels), (test_images, test_labels) = mnist.load_data()
train_images = train_images / 255.0 test_images = test_images / 255.0
model = keras.Sequential([ layers.Flatten(input_shape=(28, 28)), layers.Dense(128, activation='relu'), layers.Dropout(0.2), layers.Dense(10) ])
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True) model.compile(optimizer='adam', loss=loss_fn, metrics=['accuracy'])
model.fit(train_images, train_labels, epochs=5)
test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) print(f'\n: {test_acc*100:.2f}%')
Welcome!
reply
Welcome aboard!
reply
reply