Enum burn::backend::libtorch::LibTorchDevice
pub enum LibTorchDevice {
Cpu,
Cuda(usize),
Mps,
Vulkan,
}
Expand description
The device struct when using the tch
backend.
Note that you need to provide the device index when using Cuda.
§Example
use burn_tch::LibTorchDevice;
let device_gpu_1 = LibTorchDevice::Cuda(0); // First GPU
let device_gpu_2 = LibTorchDevice::Cuda(1); // Second GPU
let device_cpu = LibTorchDevice::Cpu; // CPU
let device_mps = LibTorchDevice::Mps; // Metal Performance Shaders
let device_vulkan = LibTorchDevice::Vulkan; // Vulkan
Variants§
Cpu
CPU device.
Cuda(usize)
Cuda device with the given index. The index is the index of the Cuda device in the list of all Cuda devices found on the system.
Mps
Metal Performance Shaders device.
Vulkan
Vulkan device.
Trait Implementations§
§impl Clone for LibTorchDevice
impl Clone for LibTorchDevice
§fn clone(&self) -> LibTorchDevice
fn clone(&self) -> LibTorchDevice
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for LibTorchDevice
impl Debug for LibTorchDevice
§impl Default for LibTorchDevice
impl Default for LibTorchDevice
§fn default() -> LibTorchDevice
fn default() -> LibTorchDevice
Returns the “default value” for a type. Read more
§impl From<Device> for LibTorchDevice
impl From<Device> for LibTorchDevice
§fn from(device: Device) -> LibTorchDevice
fn from(device: Device) -> LibTorchDevice
Converts to this type from the input type.
§impl From<LibTorchDevice> for Device
impl From<LibTorchDevice> for Device
§fn from(device: LibTorchDevice) -> Device
fn from(device: LibTorchDevice) -> Device
Converts to this type from the input type.
§impl PartialEq for LibTorchDevice
impl PartialEq for LibTorchDevice
impl Copy for LibTorchDevice
impl Eq for LibTorchDevice
impl StructuralPartialEq for LibTorchDevice
Auto Trait Implementations§
impl Freeze for LibTorchDevice
impl RefUnwindSafe for LibTorchDevice
impl Send for LibTorchDevice
impl Sync for LibTorchDevice
impl Unpin for LibTorchDevice
impl UnwindSafe for LibTorchDevice
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more§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>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.