'AutoTrackable' object is not callable in Python
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The 'AutoTrackable' object is not callable error occurs in TensorFlow when you try to call (invoke with parentheses) a loaded SavedModel object as if it were a function, but TensorFlow cannot find a callable signature. This typically happens when loading a SavedModel that was saved without specifying a concrete function signature, when accessing the wrong attribute on the loaded model, or when the model was saved using a method that does not preserve the __call__ method. The fix involves loading the model correctly and calling the right method or signature.
The Error
tf.saved_model.load() returns an AutoTrackable object (TensorFlow's base trackable class), not a Keras model. Unlike tf.keras.models.load_model(), it does not automatically have a __call__ method.
Why This Happens
TensorFlow's SavedModel format stores computation graphs as concrete functions. When you load a SavedModel, TensorFlow creates an AutoTrackable object with the saved functions as attributes. If the model was not saved with explicit signatures, the loaded object has no default callable.
Fix 1: Use tf.keras.models.load_model() for Keras Models
Fix 2: Access the Concrete Function Signature
Fix 3: Access the __call__ Method Explicitly
Fix 4: Save with Explicit Signatures
When saving, specify concrete function signatures to ensure the model is callable after loading.
Fix 5: Custom Model with @tf.function
Debugging the Loaded Object
Common Pitfalls
- Using
tf.saved_model.loadfor Keras models:tf.saved_model.load()returns anAutoTrackable, not a Keras model. For models saved withmodel.save(), always usetf.keras.models.load_model()which returns a fully functional Keras model withpredict(),evaluate(), and__call__. - Not specifying input signatures when saving: Models saved without
input_signatureon@tf.functionor without explicitsignaturesintf.saved_model.save()may not have a callable default signature. Always provide input signatures for models intended for serving or loading. - Confusing the SavedModel directory with an HDF5 file:
tf.keras.models.load_model()accepts both SavedModel directories and.h5files.tf.saved_model.load()only accepts SavedModel directories. Using the wrong loader for the format causes errors. - Signature key mismatch: The default signature key is
'serving_default', but custom models may use different keys. Always checkloaded.signatures.keys()to find available signatures before calling. - TensorFlow version mismatch: A SavedModel created with one TensorFlow version may not load correctly in another. Major version differences (TF 1.x vs 2.x) are especially problematic. Use the same TensorFlow version for saving and loading, or export to a version-compatible format.
Summary
- Use
tf.keras.models.load_model()for Keras models — it returns a callable model - Use
loaded.signatures['serving_default']to call models loaded withtf.saved_model.load() - Save with explicit
input_signatureorsignaturesparameter to ensure loaded models are callable - Inspect
loaded.signatures.keys()anddir(loaded)to debug missing callable methods AutoTrackableis TensorFlow's base class — it is not callable by default without saved signatures

