Skip to content

keras_compat

Type-checker-visible alias for tf.keras.

TensorFlow attaches keras to its top-level module through a lazy loader at import time, so no static checker can see the attribute and every tf.keras.… access is reported as unresolved. Import keras from here instead; it is the very same object as tf.keras (the TensorFlow-flavoured Keras 3 namespace, not the top-level keras package).

The lookup goes through getattr rather than attribute access with a suppression comment: a suppression would itself be reported as unused on an interpreter with no TensorFlow wheel (the 3.14 CI matrix entry), which would break the zero-warning gate.

Like helia_aot.litert.converter, this module imports TensorFlow and is therefore only importable when the optional TensorFlow dependency is present.