pub struct Engine<B: TensorBackend> { /* private fields */ }Expand description
Implementations§
Source§impl<B: TensorBackend> Engine<B>
impl<B: TensorBackend> Engine<B>
Sourcepub fn backend(&self) -> &B
pub fn backend(&self) -> &B
Borrow the backend used by this engine.
§Examples
use tenferro::{CpuBackend, Engine};
let engine = Engine::new(CpuBackend::new());
let _backend = engine.backend();Sourcepub fn einsum_cache_len(&self) -> usize
pub fn einsum_cache_len(&self) -> usize
Sourcepub fn with_einsum_cache_capacity(backend: B, capacity: NonZeroUsize) -> Self
pub fn with_einsum_cache_capacity(backend: B, capacity: NonZeroUsize) -> Self
Sourcepub fn einsum_cache_capacity(&self) -> NonZeroUsize
pub fn einsum_cache_capacity(&self) -> NonZeroUsize
Sourcepub fn set_einsum_cache_capacity(&mut self, capacity: NonZeroUsize)
pub fn set_einsum_cache_capacity(&mut self, capacity: NonZeroUsize)
Resize the einsum contraction-tree cache.
Shrinking below the current length evicts least-recently-used entries.
§Examples
ⓘ
use std::num::NonZeroUsize;
use tenferro::{CpuBackend, Engine};
let mut engine = Engine::new(CpuBackend::new());
engine.set_einsum_cache_capacity(NonZeroUsize::new(32).unwrap());Sourcepub fn eval_exec_ir(
&mut self,
program: &ExecProgram,
inputs: Vec<Tensor>,
) -> Result<Vec<Tensor>>
pub fn eval_exec_ir( &mut self, program: &ExecProgram, inputs: Vec<Tensor>, ) -> Result<Vec<Tensor>>
Evaluate an ExecProgram through this engine, reusing the persistent
einsum_cache for any NaryEinsum ops encountered in the program.
§Examples
ⓘ
use tenferro::{CpuBackend, Engine};
use tenferro::exec::ExecProgram;
let mut engine = Engine::new(CpuBackend::new());
// let outputs = engine.eval_exec_ir(&program, inputs)?;Source§impl Engine<CpuBackend>
impl Engine<CpuBackend>
Sourcepub fn buffer_pool_len(&self) -> usize
pub fn buffer_pool_len(&self) -> usize
Auto Trait Implementations§
impl<B> Freeze for Engine<B>where
B: Freeze,
impl<B> RefUnwindSafe for Engine<B>where
B: RefUnwindSafe,
impl<B> Send for Engine<B>where
B: Send,
impl<B> Sync for Engine<B>where
B: Sync,
impl<B> Unpin for Engine<B>where
B: Unpin,
impl<B> UnsafeUnpin for Engine<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for Engine<B>where
B: UnwindSafe,
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
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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