keras-team/keras · error · NotImplementedError
Model does not have a `call()` method implemented.
Error message
Model {self.__class__.__name__} does not have a `call()` method implemented. What it means
NotImplementedError from Model.call: the base Model class provides no forward pass, and a subclass was instantiated/used without overriding call(). Keras needs call() to compute outputs for fit/predict/__call__; hitting this stub means the subclass omitted it or call was invoked on the base class itself.
Solutions
- Implement a call(self, inputs, training=None, mask=None) method in your Model subclass
- If you meant a functional model, build it from Input tensors (Model(inputs, outputs)) instead of subclassing without call
- Check for a misspelled method name such as __call__ or calls instead of call
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/models/model.py:169 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/c745d2d7c235fa51.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/models/model.py:169
from keras.src.models.functional import Functional
return Functional.__new__(Functional, *args, **kwargs)
return typing.cast(cls, super().__new__(cls))
def __init__(self, *args, **kwargs):
Trainer.__init__(self)
from keras.src.models import functional
# Signature detection for usage of a `Model` subclass
# as a `Functional` subclass
if functional_init_arguments(args, kwargs):
inject_functional_model_class(self.__class__)
functional.Functional.__init__(self, *args, **kwargs)
else:
Layer.__init__(self, *args, **kwargs)
def call(self, *args, **kwargs):
raise NotImplementedError(
f"Model {self.__class__.__name__} does not have a `call()` "
"method implemented."
)
@property
def layers(self):
return list(self._flatten_layers(include_self=False, recursive=False))
@layers.setter
def layers(self, _):
raise AttributeError(
"`Model.layers` attribute is reserved and should not be used. "
"Please use another name."
)
@traceback_utils.filter_traceback
def get_layer(self, name=None, index=None):
"""Retrieves a layer based on either its name (unique) or index.View on GitHub (pinned to 7a34a03db6)