burn_backend/backend/device.rs
1pub use burn_std::device::*;
2
3/// Device trait for all burn backend devices.
4pub trait DeviceOps: Clone + Default + PartialEq + Send + Sync + core::fmt::Debug + Device {
5 /// Returns the [device id](DeviceId).
6 fn id(&self) -> DeviceId {
7 self.to_id()
8 }
9
10 /// Returns the inner device without autodiff enabled.
11 ///
12 /// For most devices this is a no-op that returns `self`. For autodiff-enabled
13 /// devices, this returns the underlying inner device.
14 fn inner(&self) -> &Self {
15 self
16 }
17}