pub struct AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,{ /* private fields */ }
Expand description
A wrapper for arrays that automatically chooses the best device.
This wrapper automatically places arrays on the most appropriate device based on their size and the operations being performed.
Implementations§
Source§impl<T, D> AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
impl<T, D> AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
Sourcepub fn on_device(&mut self, device: DeviceType) -> &dyn ArrayProtocol
pub fn on_device(&mut self, device: DeviceType) -> &dyn ArrayProtocol
Get the array on the specified device.
Sourcepub fn device(&self) -> DeviceType
pub fn device(&self) -> DeviceType
Get the current device.
Trait Implementations§
Source§impl<T, D> ArrayProtocol for AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
impl<T, D> ArrayProtocol for AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
Source§fn array_function(
&self,
func: &ArrayFunction,
types: &[TypeId],
args: &[Box<dyn Any>],
kwargs: &HashMap<String, Box<dyn Any>>,
) -> Result<Box<dyn Any>, NotImplemented>
fn array_function( &self, func: &ArrayFunction, types: &[TypeId], args: &[Box<dyn Any>], kwargs: &HashMap<String, Box<dyn Any>>, ) -> Result<Box<dyn Any>, NotImplemented>
Implementation of the array protocol. Read more
Source§fn shape(&self) -> &[usize]
fn shape(&self) -> &[usize]
Get the shape of the array (default implementation returns empty slice)
Source§fn box_clone(&self) -> Box<dyn ArrayProtocol>
fn box_clone(&self) -> Box<dyn ArrayProtocol>
Clone this array protocol object.
Source§impl<T, D> Clone for AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
impl<T, D> Clone for AutoDevice<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
Source§impl<T, D> Debug for AutoDevice<T, D>where
T: Clone + Send + Sync + Debug + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + Debug + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
impl<T, D> Debug for AutoDevice<T, D>where
T: Clone + Send + Sync + Debug + 'static + Zero + Div<f64, Output = T> + Default + Mul<Output = T> + Add<Output = T>,
D: Dimension + RemoveAxis + Debug + 'static,
SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>,
SliceInfo<[SliceInfoElem; 2], Dim<[usize; 2]>, Dim<[usize; 2]>>: SliceArg<D>,
Auto Trait Implementations§
impl<T, D> Freeze for AutoDevice<T, D>where
D: Freeze,
impl<T, D> !RefUnwindSafe for AutoDevice<T, D>
impl<T, D> Send for AutoDevice<T, D>
impl<T, D> Sync for AutoDevice<T, D>
impl<T, D> Unpin for AutoDevice<T, D>where
D: Unpin,
impl<T, D> !UnwindSafe for AutoDevice<T, D>
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<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