tensorflow

import tensorflow as tf

mnist = tf.keras.datasets.mnist

(xTrain, yTrain), (xTest, yTest) = mnist.load_data()

xTrain, xTest = xTrain / 255, xTest / 255

network = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(128, activation='relu'),
  tf.keras.layers.Dense(10, activation="sigmoid")
])

predictions = network(xTrain[:1]).numpy()

loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)

loss(yTrain[:1], predictions).numpy()

network.compile("adam", loss, ["accuracy"])

network.fit(xTrain, yTrain, epochs=5)

network.evaluate(xTest, yTest, verbose=2)
Itchy Ibex