pub struct MemoryEstimate {
pub total_bytes: usize,
pub peak_bytes: usize,
pub intermediate_count: usize,
pub max_tensor_size: usize,
pub total_elements: usize,
}Expand description
Detailed memory estimate for an expression.
Fields§
§total_bytes: usizeTotal memory needed for all tensors (in bytes)
peak_bytes: usizePeak memory usage during execution (in bytes)
intermediate_count: usizeNumber of intermediate tensors
max_tensor_size: usizeMaximum tensor size (in elements)
total_elements: usizeTotal number of elements across all tensors
Implementations§
Source§impl MemoryEstimate
impl MemoryEstimate
Sourcepub fn exceeds_limit(&self, limit_bytes: usize) -> bool
pub fn exceeds_limit(&self, limit_bytes: usize) -> bool
Check if this exceeds a memory limit (in bytes).
Sourcepub fn suggest_batch_size(
&self,
budget_bytes: usize,
current_batch: usize,
) -> usize
pub fn suggest_batch_size( &self, budget_bytes: usize, current_batch: usize, ) -> usize
Suggest optimal batch size given a memory budget.
Trait Implementations§
Source§impl Clone for MemoryEstimate
impl Clone for MemoryEstimate
Source§fn clone(&self) -> MemoryEstimate
fn clone(&self) -> MemoryEstimate
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 MemoryEstimate
impl Debug for MemoryEstimate
Source§impl Default for MemoryEstimate
impl Default for MemoryEstimate
Source§fn default() -> MemoryEstimate
fn default() -> MemoryEstimate
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryEstimate
impl RefUnwindSafe for MemoryEstimate
impl Send for MemoryEstimate
impl Sync for MemoryEstimate
impl Unpin for MemoryEstimate
impl UnwindSafe for MemoryEstimate
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