Skip to main content

device

Function device 

Source
pub fn device(cpu: bool) -> Result<Device>
Expand description

Returns the best available device for computation.

If cpu is true, always returns Device::Cpu regardless of available hardware. Otherwise prioritizes CUDA GPU if available, then Metal GPU on supported platforms, and falls back to CPU if no GPU acceleration is available.