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 duplicate 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§fn default() -> LibTorchDevice
fn default() -> LibTorchDevice
Returns the “default value” for a type. Read more
Source§impl Device for LibTorchDevice
impl Device for LibTorchDevice
Source§fn device_count(_type_id: u16) -> usize
fn device_count(_type_id: u16) -> usize
Returns the number of devices available under the provided type id.
Source§fn device_count_total() -> usize
fn device_count_total() -> usize
Returns the total number of devices that can be handled by the runtime.
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.