TensorFlow for AArch64

2.16.1 · active · verified Thu Apr 16

TensorFlow for AArch64 is an open-source machine learning framework providing a flexible architecture for high-performance numerical computation on ARM 64-bit systems. Since TensorFlow 2.10, official Linux CPU builds for AArch64/ARM64 processors are built, maintained, tested, and released by a third-party collaboration including AWS, ARM, and Linaro. The current version is 2.16.1. It follows the main TensorFlow release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a simple image classification task using the MNIST dataset and TensorFlow's Keras API. It also includes checks for TensorFlow version and available GPU devices.

import tensorflow as tf

print("TensorFlow version:", tf.__version__)

# Check for GPU devices (will be empty if only CPU is available)
gpus = tf.config.list_physical_devices('GPU')
if gpus:
    print(f"Detected GPUs: {gpus}")
else:
    print("No GPU devices found.")

mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(10)
])

loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer='adam', loss=loss_fn, metrics=['accuracy'])

print("\nTraining model...")
model.fit(x_train, y_train, epochs=1)

print("\nEvaluating model...")
model.evaluate(x_test, y_test, verbose=2)

view raw JSON →