burn-backend 0.22.0

Core backend interfaces and data structures for executing tensor operations in Burn.
Documentation

Burn Backend

The contract between Burn's tensor API and the backends that execute it

Current Crates.io Version Documentation license

Application code does not use this crate directly: it works with burn::tensor::Tensor and Device, and Burn dispatches each operation to a backend at runtime. This crate is for code below that boundary: backend implementations, backend decorators such as autodiff and fusion, and backend extensions.

It defines:

  • BackendTypes, which names a backend's tensor primitives and device type.
  • Backend and the operation traits in ops, every tensor operation a backend implements. AutodiffBackend adds gradient support.
  • DeviceOps, a backend device and its default dtypes.
  • TensorData, DType, Shape and the element traits, which describe tensor data independently of any backend.

Operations report device failures as ExecutionError instead of panicking.

Feature Flags

  • std (default): standard library support. Without it the crate is no_std with alloc.
  • cubecl: conversions between Burn and CubeCL types.
  • cubecl-device and cubecl-<runtime>: implement DeviceOps for cubecl::Device.
  • tracing: instrument operations with the tracing crate.

See the contributor book for how backends fit into Burn's architecture.


Part of the Burn deep learning framework. See the Burn Book and the API documentation.