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; // VulkanVariants§
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§
Source§impl Clone for LibTorchDevice
impl Clone for LibTorchDevice
Source§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 moreSource§impl Debug for LibTorchDevice
impl Debug for LibTorchDevice
Source§impl Default for LibTorchDevice
impl Default for LibTorchDevice
Source§impl From<Device> for LibTorchDevice
impl From<Device> for LibTorchDevice
Source§impl From<LibTorchDevice> for Device
impl From<LibTorchDevice> for Device
Source§fn from(device: LibTorchDevice) -> Self
fn from(device: LibTorchDevice) -> Self
Converts to this type from the input type.
Source§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§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
Compare self to
key and return true if they are equal.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