Burn Backend Dispatch
Runtime backend selection for Burn
Dispatch is the backend behind every burn::tensor::Tensor. It holds the tensor primitives of
each backend compiled into the application and routes every operation to the backend that owns
its tensors, so model code has no backend type parameter and one program can use several
backends side by side.
Operations follow Tensor -> BridgeTensor -> DispatchTensor -> backend primitive. Dispatch also
carries each tensor's autodiff and gradient-checkpointing context.
Applications do not use this crate directly: Burn's backend features (cuda, wgpu, flex, ...)
enable the matching dispatch features, and a Device constructor picks the backend at runtime.
Backends
| Variant | Features | Backend |
|---|---|---|
Cube |
cpu, cuda, metal, rocm, vulkan, webgpu, wgpu |
burn-cubecl, every CubeCL runtime |
Flex |
flex |
burn-flex, pure Rust CPU |
Remote |
remote |
burn-remote, devices on another server |
Capture |
capture |
burn-capture, records instead of executing |
NdArray |
ndarray |
burn-ndarray, deprecated |
LibTorch |
tch |
burn-tch, deprecated |
autodiff wraps any of them in burn-autodiff, and fusion turns on kernel
fusion for the CubeCL and remote backends. Features combine freely.
Backend extensions add operations to dispatch with the #[backend_extension] macro from
burn-backend-extension.
Part of the Burn deep learning framework. See the Burn Book and the API documentation.