Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

TF addons compatibility with TF nightly / TF2.2 #1716

@nnigania

Description

@nnigania

I am using a tf addons library function (Gelu) with TF2.2 nightly. It currently complains about compatibility issue below. The aim of this bug to cleanup this warning.

"
/usr/local/lib/python3.6/dist-packages/tensorflow_addons/utils/resource_loader.py:95: UserWarning: You are currently using TensorFlow 2.2.0-dev20200421 and trying to load a custom op (custom_ops/activations/_activation_ops.so).
TensorFlow Addons has compiled its custom ops against TensorFlow 2.1.0, and there are no compatibility guarantees between the two versions.
This means that you might get segfaults when loading the custom op, or other kind of low-level errors.
If you do, do not file an issue on Github. This is a known limitation.

It might help you to fallback to pure Python ops with TF_ADDONS_PY_OPS . To do that, see https://github.com/tensorflow/addons#gpucpu-custom-ops

You can also change the TensorFlow version installed on your system. You would need a TensorFlow version equal to or above 2.1.0 and strictly below 2.2.0.
Note that nightly versions of TensorFlow, as well as non-pip TensorFlow like conda install tensorflow or compiled from source are not supported.

The last solution is to find the TensorFlow Addons version that has custom ops compatible with the TensorFlow installed on your system. To do that, refer to the readme: https://github.com/tensorflow/addons
UserWarning,
/usr/local/lib/python3.6/dist-packages/tensorflow_addons/options.py:47: RuntimeWarning: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow_addons/activations/gelu.py", line 49, in gelu
return _gelu_custom_op(x, approximate)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_addons/activations/gelu.py", line 57, in _gelu_custom_op
return _activation_so.ops.addons_gelu(x, approximate)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_addons/utils/resource_loader.py", line 56, in ops
self._ops = tf.load_op_library(get_path_to_datafile(self.relative_path))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/load_library.py", line 58, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /usr/local/lib/python3.6/dist-packages/tensorflow_addons/custom_ops/activations/_activation_ops.so: undefined symbol: _ZN10tensorflow14kernel_factory17OpKernelRegistrar12InitInternalEPKNS_9KernelDefEN4absl11string_viewESt10unique_ptrINS0_15OpKernelFactoryESt14default_deleteIS8_EE

The gelu C++/CUDA custom op could not be loaded.
For this reason, Addons will fallback to an implementation written
in Python with public TensorFlow ops. There worst you might experience with
this is a moderate slowdown on GPU. There can be multiple
reason for this loading error, one of them may be an ABI incompatibility between
the TensorFlow installed on your system and the TensorFlow used to compile
TensorFlow Addons' custom ops. The stacktrace generated when loading the
shared object file was displayed above.
"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions