get_default_device

Function get_default_device 

Source
pub fn get_default_device() -> Device
Expand description

Get the global default device

§Returns

The current global default device

§Thread Safety

This function is thread-safe and uses atomic operations to read the global default.

§Examples

use train_station::{Device, get_default_device, set_default_device};

let initial_default = get_default_device();
assert!(initial_default.is_cpu());

set_default_device(Device::cpu());
assert_eq!(get_default_device(), Device::cpu());