Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Burn WGPU Backend
Burn WGPU backend
This crate provides a WGPU backend for Burn using the wgpu.
The backend supports Vulkan, Metal, DirectX 12, OpenGL, and WebGPU.
Usage Example
For application code, enable Burn's wgpu feature and select the device at runtime:
= { = "0.22", = ["wgpu"] }
use ;
let device = wgpu;
let input = ones;
let output = input + 1.0;
For training, enable autodiff (also enabled by train) and use device.autodiff() before
initializing model parameters and inputs. Tensor and model types have no backend parameter.
Configuration
Use Device::wgpu_options() to configure the runtime before creating tensors:
use ;
let device = wgpu_options
.graphics_api
.tasks_max
.init?;
Use .init_async().await? in browsers or async applications. Options also include
.memory_config(...) and .setup(...) for existing wgpu handles.
Use Device::configure for dtype defaults.
Graphics API and shader compiler
Enable vulkan, metal, or webgpu and select the corresponding Device constructor to target
that graphics API. AutoCompiler selects the shader compiler at runtime. There is no spirv
feature or compiler type parameter on Wgpu in 0.22. Multiple backend features can be enabled
together. The Vulkan, Metal, and WebGpu aliases are deprecated: use Wgpu with an explicit
device constructor to select the graphics API.
Platform Support
| Option | CPU | GPU | Linux | MacOS | Windows | Android | iOS | WASM |
|---|---|---|---|---|---|---|---|---|
| Metal | No | Yes | No | Yes | No | No | Yes | No |
| Vulkan | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| OpenGL | No | Yes | Yes | Yes | Yes | Yes | Yes | No |
| WebGpu | No | Yes | No | No | No | No | No | Yes |
| Dx12 | No | Yes | No | No | Yes | No | No | No |
Part of the Burn deep learning framework. See the Burn Book and the API documentation.