pub struct LayoutOptimizer { /* private fields */ }Expand description
Layout optimizer that chooses optimal data layouts based on device and operation type
Implementations§
Source§impl LayoutOptimizer
impl LayoutOptimizer
Sourcepub fn preferred_layout(
&self,
device: &Device,
op_type: OperationType,
) -> DataLayout
pub fn preferred_layout( &self, device: &Device, op_type: OperationType, ) -> DataLayout
Get the preferred layout for a given device and operation type
Sourcepub fn conversion_cost(&self, from: DataLayout, to: DataLayout) -> f32
pub fn conversion_cost(&self, from: DataLayout, to: DataLayout) -> f32
Get the cost of converting between two layouts
Sourcepub fn should_convert(
&self,
from: DataLayout,
to: DataLayout,
operation_benefit: f32,
) -> bool
pub fn should_convert( &self, from: DataLayout, to: DataLayout, operation_benefit: f32, ) -> bool
Determine if a layout conversion is beneficial
Sourcepub fn auto_layout(
&self,
current_layout: DataLayout,
target_device: &Device,
op_type: OperationType,
operation_intensity: f32,
) -> DataLayout
pub fn auto_layout( &self, current_layout: DataLayout, target_device: &Device, op_type: OperationType, operation_intensity: f32, ) -> DataLayout
Auto-select the best layout for a tensor given the target device and operation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LayoutOptimizer
impl RefUnwindSafe for LayoutOptimizer
impl Send for LayoutOptimizer
impl Sync for LayoutOptimizer
impl Unpin for LayoutOptimizer
impl UnsafeUnpin for LayoutOptimizer
impl UnwindSafe for LayoutOptimizer
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> 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