keras-team/keras · error · NotImplementedError

_backend_add_endpoint() must be implemented in backend subcl

Error message

_backend_add_endpoint() must be implemented in backend subclasses.

What it means

Error "_backend_add_endpoint() must be implemented in backend subclasses." thrown in keras-team/keras.

Source

Thrown at keras/src/export/saved_model_export_archive.py:158

                    ")"
                )
            setattr(self._tf_trackable, name, decorated_fn)
            self._endpoint_names.append(name)
            return decorated_fn

        input_signature = tree.map_structure(
            make_tf_tensor_spec, input_signature
        )
        decorated_fn = self._backend_add_endpoint(
            name, fn, input_signature, **kwargs
        )
        self._endpoint_signatures[name] = input_signature
        setattr(self._tf_trackable, name, decorated_fn)
        self._endpoint_names.append(name)
        return decorated_fn

    def _backend_add_endpoint(self, name, fn, input_signature, **kwargs):
        raise NotImplementedError(
            "_backend_add_endpoint() must be implemented in backend subclasses."
        )

    def track_and_add_endpoint(self, name, resource, input_signature, **kwargs):
        """Track the variables and register a new serving endpoint.

        This function combines the functionality of `track` and `add_endpoint`.
        It tracks the variables of the `resource` (either a layer or a model)
        and registers a serving endpoint using `resource.__call__`.

        Args:
            name: `str`. The name of the endpoint.
            resource: A trackable Keras resource, such as a layer or model.
            input_signature: Optional. Specifies the shape and dtype of `fn`.
                Can be a structure of `keras.InputSpec`, `tf.TensorSpec`,
                `backend.KerasTensor`, or backend tensor (see below for an
                example showing a `Functional` model with 2 input arguments). If
                not provided, `fn` must be a `tf.function` that has been called

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/export/saved_model_export_archive.py:158 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/3fddc38d32967365. Report an issue: GitHub.