pub struct CpuPlan { /* private fields */ }Expand description
A compiled model prepared for CPU evaluation.
Implementations§
Source§impl CpuPlan
impl CpuPlan
Sourcepub fn parameter_count(&self) -> usize
pub fn parameter_count(&self) -> usize
Returns the number of parameters, including fixed parameters.
Sourcepub fn free_parameter_count(&self) -> usize
pub fn free_parameter_count(&self) -> usize
Returns the number of free parameters.
Sourcepub fn cache_plan(&self) -> &CachePlan
pub fn cache_plan(&self) -> &CachePlan
Returns the event-cache layout required by this plan.
Sourcepub fn evaluate(&self, params: &ParamValues) -> RuntimeResult<Complex64>
pub fn evaluate(&self, params: &ParamValues) -> RuntimeResult<Complex64>
Evaluates a model that has no event-dependent inputs.
§Errors
Returns RuntimeError when parameters are incompatible, the model
requires event data, evaluation fails, or a matrix is singular.
Sourcepub fn evaluate_with_gradient(
&self,
params: &ParamValues,
) -> RuntimeResult<ValueGradient>
pub fn evaluate_with_gradient( &self, params: &ParamValues, ) -> RuntimeResult<ValueGradient>
Evaluates an event-independent model and its free-parameter gradient.
§Errors
Returns RuntimeError when parameters are incompatible, the model
requires event data, differentiation or evaluation fails, or a solve is
singular.
Sourcepub fn evaluate_with_event(
&self,
params: &ParamValues,
event: &impl EventLookup,
) -> RuntimeResult<Complex64>
pub fn evaluate_with_event( &self, params: &ParamValues, event: &impl EventLookup, ) -> RuntimeResult<Complex64>
Evaluates the model using values supplied by an event lookup.
§Errors
Returns RuntimeError when a required event value is missing,
parameters are incompatible, evaluation fails, or a solve is singular.
Sourcepub fn evaluate_with_event_and_gradient(
&self,
params: &ParamValues,
event: &impl EventLookup,
) -> RuntimeResult<ValueGradient>
pub fn evaluate_with_event_and_gradient( &self, params: &ParamValues, event: &impl EventLookup, ) -> RuntimeResult<ValueGradient>
Evaluates the model and gradient using values supplied by an event lookup.
§Errors
Returns RuntimeError when a required event value is missing,
parameters are incompatible, or differentiation or evaluation fails.
Sourcepub fn cache_event_batch(
&self,
batch: &EventBatch,
) -> RuntimeResult<CpuBatchCache>
pub fn cache_event_batch( &self, batch: &EventBatch, ) -> RuntimeResult<CpuBatchCache>
Materializes the event-dependent cache for a batch.
§Errors
Returns RuntimeError when required columns are missing, expression
shapes are invalid, cache construction fails, or a matrix is singular.
§Panics
Panics if a node selected by the validated cache plan was not evaluated.
Sourcepub fn evaluate_cache(
&self,
params: &ParamValues,
cache: &CpuBatchCache,
) -> RuntimeResult<Vec<Complex64>>
pub fn evaluate_cache( &self, params: &ParamValues, cache: &CpuBatchCache, ) -> RuntimeResult<Vec<Complex64>>
Evaluates every row in a materialized batch cache.
§Errors
Returns RuntimeError when parameters or cache layout are
incompatible, evaluation fails, or a matrix is singular.
Sourcepub fn evaluate_cache_row(
&self,
params: &ParamValues,
cache: &CpuBatchCache,
row: usize,
) -> RuntimeResult<Complex64>
pub fn evaluate_cache_row( &self, params: &ParamValues, cache: &CpuBatchCache, row: usize, ) -> RuntimeResult<Complex64>
Evaluates one row in a materialized batch cache.
§Errors
Returns RuntimeError when row is out of range, parameters or cache
layout are incompatible, evaluation fails, or a matrix is singular.
Source§impl CpuPlan
impl CpuPlan
Sourcepub fn evaluate_cache_row_with_gradient(
&self,
params: &ParamValues,
cache: &CpuBatchCache,
row: usize,
) -> RuntimeResult<ValueGradient>
pub fn evaluate_cache_row_with_gradient( &self, params: &ParamValues, cache: &CpuBatchCache, row: usize, ) -> RuntimeResult<ValueGradient>
Evaluates one cached row and its free-parameter gradient.
§Errors
Returns RuntimeError when row is out of range, parameters or cache
layout are incompatible, or differentiation or evaluation fails.
Sourcepub fn evaluate_cache_with_gradient(
&self,
params: &ParamValues,
cache: &CpuBatchCache,
) -> RuntimeResult<Vec<ValueGradient>>
pub fn evaluate_cache_with_gradient( &self, params: &ParamValues, cache: &CpuBatchCache, ) -> RuntimeResult<Vec<ValueGradient>>
Evaluates every cached row and its free-parameter gradient.
§Errors
Returns RuntimeError when parameters or cache layout are
incompatible, or differentiation or evaluation fails.
Sourcepub fn evaluate_batch(
&self,
params: &ParamValues,
batch: &EventBatch,
) -> RuntimeResult<Vec<Complex64>>
pub fn evaluate_batch( &self, params: &ParamValues, batch: &EventBatch, ) -> RuntimeResult<Vec<Complex64>>
Evaluates the model for every event in a batch.
§Errors
Returns RuntimeError when cache materialization or evaluation fails.
Sourcepub fn evaluate_batch_with_gradient(
&self,
params: &ParamValues,
batch: &EventBatch,
) -> RuntimeResult<Vec<ValueGradient>>
pub fn evaluate_batch_with_gradient( &self, params: &ParamValues, batch: &EventBatch, ) -> RuntimeResult<Vec<ValueGradient>>
Evaluates the model and gradient for every event in a batch.
§Errors
Returns RuntimeError when cache materialization, differentiation, or
evaluation fails.
Sourcepub fn cache_dataset(
&self,
dataset: &Dataset,
) -> RuntimeResult<CpuCachedDataset>
pub fn cache_dataset( &self, dataset: &Dataset, ) -> RuntimeResult<CpuCachedDataset>
Materializes all event-dependent caches for a dataset.
§Errors
Returns RuntimeError when the dataset cannot be read, a batch schema
is incompatible, cache construction fails, or a matrix is singular.
Sourcepub fn cache_memory_estimate(&self, events: usize) -> usize
pub fn cache_memory_estimate(&self, events: usize) -> usize
Estimates retained compiled-cache bytes for events.
Sourcepub fn prepare_dataset(
&self,
execution: &Execution,
dataset: &Dataset,
) -> RuntimeResult<CpuPreparedDataset>
pub fn prepare_dataset( &self, execution: &Execution, dataset: &Dataset, ) -> RuntimeResult<CpuPreparedDataset>
Prepares a dataset according to its cache-storage policy.
§Errors
Returns RuntimeError when dataset reading or cache construction
fails, or another distributed worker reports failure.
Sourcepub fn reduce(
&self,
execution: &Execution,
params: &ParamValues,
dataset: &CpuPreparedDataset,
reduction: ReductionPlan,
) -> RuntimeResult<f64>
pub fn reduce( &self, execution: &Execution, params: &ParamValues, dataset: &CpuPreparedDataset, reduction: ReductionPlan, ) -> RuntimeResult<f64>
Execute a weighted reduction over a prepared dataset.
§Errors
Returns RuntimeError when streaming, cache validation, evaluation,
or reduction fails, or another distributed worker reports failure.
Sourcepub fn reduce_with_gradient(
&self,
execution: &Execution,
params: &ParamValues,
dataset: &CpuPreparedDataset,
reduction: ReductionPlan,
) -> RuntimeResult<ReductionEvaluation>
pub fn reduce_with_gradient( &self, execution: &Execution, params: &ParamValues, dataset: &CpuPreparedDataset, reduction: ReductionPlan, ) -> RuntimeResult<ReductionEvaluation>
Execute a weighted reduction and its free-parameter gradient.
§Errors
Returns RuntimeError when streaming, cache validation,
differentiation, evaluation, or reduction fails, or another distributed
worker reports failure.
Sourcepub fn evaluate_cached_dataset(
&self,
params: &ParamValues,
dataset: &CpuCachedDataset,
) -> RuntimeResult<Vec<Complex64>>
pub fn evaluate_cached_dataset( &self, params: &ParamValues, dataset: &CpuCachedDataset, ) -> RuntimeResult<Vec<Complex64>>
Evaluates every event in a fully cached dataset.
§Errors
Returns RuntimeError when parameters or a cache layout are
incompatible, evaluation fails, or a matrix is singular.
Sourcepub fn evaluate_cached_dataset_with_gradient(
&self,
params: &ParamValues,
dataset: &CpuCachedDataset,
) -> RuntimeResult<Vec<ValueGradient>>
pub fn evaluate_cached_dataset_with_gradient( &self, params: &ParamValues, dataset: &CpuCachedDataset, ) -> RuntimeResult<Vec<ValueGradient>>
Evaluates every event and gradient in a fully cached dataset.
§Errors
Returns RuntimeError when parameters or a cache layout are
incompatible, or differentiation or evaluation fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CpuPlan
impl RefUnwindSafe for CpuPlan
impl Send for CpuPlan
impl Sync for CpuPlan
impl Unpin for CpuPlan
impl UnsafeUnpin for CpuPlan
impl UnwindSafe for CpuPlan
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.