Skip to main content

BatchExecutor

Struct BatchExecutor 

Source
pub struct BatchExecutor<'program> { /* private fields */ }
Expand description

Reusable buffers for running one program on batches of records.

Implementations§

Source§

impl<'program> BatchExecutor<'program>

Source

pub fn new(program: &'program TensorProgram) -> BatchExecutor<'program>

Source

pub fn run(&mut self, sources: &[f32]) -> Vec<f32>

Evaluate the program on consecutive source tables, program.source_size values each, and return the roots’ values, program.roots.len() per record. Sources aren’t range-checked; see Circuit::validate_source_ranges.

Source

pub fn run_into(&mut self, sources: &[f32], outputs: &mut Vec<f32>)

run, appending to outputs.

Source

pub fn run_parallel( program: &TensorProgram, sources: &[f32], threads: Option<usize>, ) -> Vec<f32>

BatchExecutor::run split across threads threads (all available cores when None), with the outputs in record order.

Auto Trait Implementations§

§

impl<'program> Freeze for BatchExecutor<'program>

§

impl<'program> RefUnwindSafe for BatchExecutor<'program>

§

impl<'program> Send for BatchExecutor<'program>

§

impl<'program> Sync for BatchExecutor<'program>

§

impl<'program> Unpin for BatchExecutor<'program>

§

impl<'program> UnsafeUnpin for BatchExecutor<'program>

§

impl<'program> UnwindSafe for BatchExecutor<'program>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<E> StoreElem<usize> for E

Source§

fn store(items: &mut [E], index: usize, value: E)

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.