Install & Compatibility
Where this runs
tested against v0.23.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 15.6s
py 3.11
✕ build_error
✓ 14.25s
py 3.12
✕ build_error
✕ build_error
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 19.2s
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
tfa
✓ import tensorflow_addons as tfa
tfa.activations
✓ import tensorflow_addons.activations as tfa_activations
tfa.layers
✓ import tensorflow_addons.layers as tfa_layers
tfa.optimizers
✓ import tensorflow_addons.optimizers as tfa_optimizers
tfa.losses
✓ import tensorflow_addons.losses as tfa_losses
tfa.metrics
✓ import tensorflow_addons.metrics as tfa_metrics
This quickstart demonstrates how to integrate a TensorFlow Addons layer (`GroupNormalization`) and an optimizer (`AdamW`) into a standard Keras model. It compiles and runs a single training epoch with dummy data.
import tensorflow as tf
import tensorflow_addons as tfa
# Define a simple Keras model with a TFA layer and optimizer
model = tf.keras.Sequential([
tf.keras.layers.InputLayer(input_shape=(10,)),
tf.keras.layers.Dense(128, activation='relu'),
tfa.layers.GroupNormalization(groups=8, axis=-1), # Example TFA layer
tf.keras.layers.Dense(10, activation='softmax')
])
# Use a TFA optimizer
optimizer = tfa.optimizers.AdamW(weight_decay=0.001, learning_rate=0.001)
model.compile(optimizer=optimizer,
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
# Create dummy data
import numpy as np
x_train = np.random.rand(100, 10).astype(np.float32)
y_train = np.random.randint(0, 10, 100)
print("Model summary:")
model.summary()
print("\nTraining model with TFA components...")
model.fit(x_train, y_train, epochs=1, batch_size=32, verbose=0)
print("Training complete.")
Debug
Known issues
breakingTensorFlow Addons (TFA) has reached its planned end of life in May 2024. Development of new features has ceased, and the library is in a minimal maintenance mode. Users are advised to migrate to other TensorFlow community repositories (e.g., Keras, Keras-CV, Keras-NLP).fixMigrate functionality to core TensorFlow, Keras, or other specialized TensorFlow community libraries. Review release notes for specific component migration paths.
affects: 0.x.x (post-May 2024)
gotchaCompatibility with TensorFlow versions is crucial. TensorFlow Addons is only guaranteed to be compatible with the TensorFlow versions it was tested against. Warnings will be emitted if versions do not match, and custom C++ operations may lead to segmentation faults or crashes with incompatible TensorFlow builds (e.g., `conda` installations).fixAlways install `tensorflow-addons` with the `[tensorflow]` extra (e.g., `pip install tensorflow-addons[tensorflow]`) or verify the compatibility matrix on the official GitHub page. Avoid `conda`-installed TensorFlow for custom ops.
affects: All versions
deprecatedSome functionalities, like `tfa.activations.gelu` and `data_format` arguments in `tensorflow_addons/image`, have been deprecated, with `gelu` migrating to core TensorFlow.fixConsult the `tensorflow-addons` release notes and documentation for specific replacements. For `gelu`, use `tf.keras.activations.gelu` or `tf.nn.gelu`.
affects: 0.12.0 and later
breakingWindows support for `tensorflow-addons` was dropped due to inconsistent TensorFlow 2.15 `.whl` packaging. Users on Windows will fall back to pure TensorFlow Python implementations where possible for custom ops.fixUse Linux or macOS for full `tensorflow-addons` functionality, especially for GPU custom operations. If on Windows, be aware of potential performance implications or missing custom op functionality.
affects: All versions (post TF 2.15 incompatibility)
gotchaAPIs in TensorFlow Addons might evolve more rapidly than those in core TensorFlow. While the SIG strives for stability, frequent updates can introduce changes.fixRegularly check release notes and changelogs when upgrading `tensorflow-addons` to understand any API modifications.
affects: All versions
Upgrade
Version history
0.23.0latest on PyPI · released Nov 28, 2023
Audit
Dependencies
tensorflowrequiredTensorFlow Addons provides functionality that extends TensorFlow and requires a compatible version of TensorFlow to be installed.