class
NotSupported
PythonThe active Keras backend is not supported by this trainer.
NotSupported()The active Keras backend is not supported by this trainer.
Training steps that dispatch on the active Keras backend.
NotSupportedclassThe active Keras backend is not supported by this trainer.require_backendfunctionReturn the active backend, or raise NotSupported naming feature and supported.no_gradfunctionDisable gradient tracking on Torch; a no-op on other backends.gradient_stepfunctionDifferentiate lossfn with the active backend and apply model.optimizer once.The active Keras backend is not supported by this trainer.
NotSupported()The active Keras backend is not supported by this trainer.
Return the active backend, or raise NotSupported naming feature and supported.
require_backend(feature: str, supported: Sequence[str]) -> strReturn the active backend, or raise NotSupported naming feature and supported.
Disable gradient tracking on Torch; a no-op on other backends.
no_grad() -> Iterator[None]Disable gradient tracking on Torch; a no-op on other backends.
Differentiate lossfn with the active backend and apply model.optimizer once.
gradient_step( model: keras.Model, loss_fn: Callable[[], tuple[Any, ...]], variables: Sequence[Any] | None = None,) -> tuple[Any, ...]Differentiate loss_fn with the active backend and apply model.optimizer once.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
model | keras.Model | Required | Compiled model whose optimizer applies the update. |
loss_fn | Callable[[], tuple[Any, ...]] | Required | Computes ``(loss, *outputs)`` from the model's current weights. |
variables | Sequence[Any] | None | None | Variables to update; when None, the model's trainable weights after ``loss_fn`` runs, so variables created by a first (building) call are included. Variables without a gradient are skipped. |
Returns
| Value | Type | Description |
|---|---|---|
tuple | tuple[Any, ...] | What ``loss_fn`` returned. |
Raises
| Type | Description |
|---|---|
NotSupported | On backends other than TensorFlow and Torch. |