Keras 3 is a Python API with selectable numerical backends. TensorFlow, JAX and PyTorch provide different execution stacks beneath it. Choosing the backend determines which framework handles tensor operations and devices; calling model.compile does not establish one universal compiler path. This diagram shows the routing boundary and links to the detailed execution path for each framework.
Showing the TensorFlow backend on the CPU: 5 stages, 4 steps.
Your program
Framework core
Hardware
The selected path, step by step
Your Keras code calls Keras Keras 3 API: Python enters the shared Keras API rather than selecting numerical kernels directly.
Keras 3 API uses configured backend Backend dispatch: The selected backend must already be configured when Keras is imported.
Backend dispatch routes to tensorflow TensorFlow backend: Keras exposes the backend selected for this process.
TensorFlow backend targets CPU CPU: The selected backend handles supported operations on this configured device; internal compiler stages are linked from the text.
Is Keras the same thing as TensorFlow?
No. Keras 3 can use TensorFlow, JAX or PyTorch as a numerical backend, and also documents an OpenVINO inference-only option. The Keras README describes these choices. A tutorial using tf.keras tells you something about that tutorial’s integration; the broader Keras 3 project is not limited to that one stack.
This page separates the Python-facing API from numerical execution. Building layers, configuring a loss and handling model structure belong to the Keras interface. The selected backend determines which tensor implementation and hardware runtime actually carry out the work. Different backend choices therefore lead to different implementation paths even when the Keras model looks similar.
When does KERAS_BACKEND take effect?
The getting-started guide documents KERAS_BACKEND and the Keras configuration file. Configure the backend before importing Keras. This is a process-level choice in the documented startup workflow, not a per-layer switch that can be changed at an arbitrary point in an already imported program.
Use the control above to compare routes conceptually. It does not execute a model or rewrite the local environment. A working installation still needs the selected backend package and its appropriate CPU or GPU dependencies.
What changes with TensorFlow, JAX or PyTorch?
With TensorFlow, operations can follow eager execution, traced graph execution or explicit XLA compilation. With JAX, tracing, XLA lowering and device execution have their own rules. With PyTorch, eager dispatch and torch.compile are distinct paths. The diagram ends at the backend’s device target so it does not incorrectly present one compiler pipeline as common to all three.
The backend dispatch source shows separate imports for those implementations. That is stronger evidence for the routing boundary than inferring execution from the language percentages reported on a repository page.
Does model.compile mean the same thing on every backend?
Treat the high-level compile API as model configuration, and inspect the documented backend settings before drawing conclusions about machine-code compilation. TensorFlow’s tf.function, JAX’s jit and PyTorch’s torch.compile are different mechanisms. Their names are not interchangeable evidence that a particular kernel fusion or compiler was used.
The same caution applies to performance comparisons: keep model, shapes, precision, device configuration and warmup behavior comparable. This page does not rank frameworks or assume that changing a backend preserves every custom operation or execution detail.
Does selecting a GPU remove Python and CPU work?
No. The selected framework manages device placement and its CPU-side orchestration. The Keras device context exposes backend-independent placement controls, but each backend still needs its own working GPU runtime. The implementation explicitly maps PyTorch’s GPU terminology to CUDA. This page’s GPU route covers supported device operations, not every line of Python.
Every stage
Your Keras code
programming language
A Python program constructs layers or invokes Keras tensor operations.
Keras 3 backend routing for compatible tensor operations or models using TensorFlow, JAX or PyTorch on CPU or a supported configured GPU. This is a routing overview, not a complete training loop or a guarantee of identical backend behavior. OpenVINO inference, NumPy fallback, pluggable backends, distributed training, optimizer internals and framework-specific compilation settings are outside the diagram.
How this page is checked
Every stage and step above quotes the source that supports it. The quotes were checked against the Keras 3 README, backend-configuration guide and Python backend-dispatch implementation on 2026-11-11. The data is a versioned JSON file under the same CC BY 4.0 license as the dataset. Found something wrong or out of date? Open an issue with the better source.