Skip to main content

default_burn_device

Function default_burn_device 

Source
pub fn default_burn_device<B: Backend>() -> <B as BackendTypes>::Device
Expand description

Backend-generic default device helper for the Burn path.

Burn’s device type is associated with the backend (B::Device); each backend implements Default for it, so for CPU (NdArray) this returns the singleton CPU device, for Wgpu the default GPU adapter, and so on. Trainer code that wants to stay backend-agnostic should call this instead of constructing a device manually.

§Example

use burn::backend::NdArray;
use thrust_rl::utils::cuda::default_burn_device;

let device = default_burn_device::<NdArray<f32>>();