pub enum Device {
Cpu,
Cuda(usize),
Xpu(usize),
Mps(usize),
Meta,
}Expand description
Device on which a tensor’s data resides.
Meta is a special device that does not allocate any backing memory:
meta tensors carry shape, dtype, and device information but no data.
They are useful for shape inference, dry-run model construction, and
inspecting parameter counts of huge models without actually allocating
the weights. Mirrors torch.device("meta").
Xpu mirrors PyTorch’s torch.device("xpu") and addresses Intel
GPUs (Arc series, Data Center GPU Max) via the portable CubeCL
wgpu runtime that the ferrotorch-xpu crate wraps. CL-452.
Variants§
Cpu
CPU main memory.
Cuda(usize)
CUDA GPU with the given device index.
Xpu(usize)
Intel XPU (Arc / Data Center GPU Max) with the given device index.
Accessed via ferrotorch-xpu which wraps a CubeCL wgpu runtime.
CL-452.
Mps(usize)
Apple Silicon Metal Performance Shaders. The usize is the Metal
device index (0 is the system default GPU). Mirrors
torch.device("mps"). Implemented via ferrotorch-mps. (#451)
Meta
Meta device — shape-only, no backing storage. Operations that need data return an error; operations that only manipulate metadata (reshape, view, permute, narrow, transpose, …) work normally and produce meta tensors as output. CL-395.
Implementations§
Trait Implementations§
impl Copy for Device
impl Eq for Device
impl StructuralPartialEq for Device
Auto Trait Implementations§
impl Freeze for Device
impl RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnsafeUnpin for Device
impl UnwindSafe for Device
Blanket Implementations§
Source§impl<U> AsDistAny for Uwhere
U: 'static,
impl<U> AsDistAny for Uwhere
U: 'static,
Source§fn as_dist_any(&self) -> &(dyn Any + 'static)
fn as_dist_any(&self) -> &(dyn Any + 'static)
&dyn Any for concrete-type downcasting.impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more