pub struct UnboundedPolicy;Expand description
An EvictionPolicy that never evicts
The cache grows without bound, keeping every skeleton it has ever built. Use it when the set of input shapes is small and known to be finite.
§Examples
use candela::skeleton::{SkeletonSlot, UnboundedDynamicSkeleton};
use candela::{Layout, Tensor};
// Selected here through the UnboundedDynamicSkeleton alias.
let sk: UnboundedDynamicSkeleton<f32> =
UnboundedDynamicSkeleton::new(0, Box::new(|inputs: &[Layout]| {
let a = SkeletonSlot::new(inputs[0].clone());
(&a * 2.0).into_skeleton(&[a]).unwrap()
}));
assert_eq!(sk.run(&[&Tensor::from_scalar(3.0, &[4])])?.data(), &[6.0; 4]);Trait Implementations§
Source§impl Clone for UnboundedPolicy
impl Clone for UnboundedPolicy
Source§fn clone(&self) -> UnboundedPolicy
fn clone(&self) -> UnboundedPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for UnboundedPolicy
Source§impl Debug for UnboundedPolicy
impl Debug for UnboundedPolicy
Source§impl Default for UnboundedPolicy
impl Default for UnboundedPolicy
Source§fn default() -> UnboundedPolicy
fn default() -> UnboundedPolicy
Returns the “default value” for a type. Read more
impl Eq for UnboundedPolicy
Source§impl EvictionPolicy for UnboundedPolicy
impl EvictionPolicy for UnboundedPolicy
Source§impl Hash for UnboundedPolicy
impl Hash for UnboundedPolicy
Source§impl PartialEq for UnboundedPolicy
impl PartialEq for UnboundedPolicy
Source§fn eq(&self, other: &UnboundedPolicy) -> bool
fn eq(&self, other: &UnboundedPolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for UnboundedPolicy
Auto Trait Implementations§
impl Freeze for UnboundedPolicy
impl RefUnwindSafe for UnboundedPolicy
impl Send for UnboundedPolicy
impl Sync for UnboundedPolicy
impl Unpin for UnboundedPolicy
impl UnsafeUnpin for UnboundedPolicy
impl UnwindSafe for UnboundedPolicy
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