pub enum PreparedModel {
Cpu(Box<CpuPlan>),
}Expand description
A compiled model prepared for a concrete execution backend.
Variants§
Implementations§
Source§impl PreparedModel
impl PreparedModel
Sourcepub fn required_event_scalars(&self) -> &[String]
pub fn required_event_scalars(&self) -> &[String]
Returns the event-scalar columns required by this prepared model.
Requirements are deduplicated while retaining compiled graph order.
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 parameters or event columns are
incompatible, evaluation fails, or a matrix solve is singular.
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 its free-parameter gradient for every event in a batch.
§Errors
Returns RuntimeError when inputs are incompatible, differentiation
or evaluation fails, or the selected backend lacks event-wise gradients.
Sourcepub fn prepare(
model: &CompiledModel,
execution: &Execution,
) -> RuntimeResult<Self>
pub fn prepare( model: &CompiledModel, execution: &Execution, ) -> RuntimeResult<Self>
Prepares a compiled model for the supplied execution context.
§Errors
Returns RuntimeError when model lowering, differentiation, backend
initialization, or precision selection fails.
Sourcepub fn prepare_dataset(
&self,
execution: &Execution,
dataset: &Dataset,
) -> RuntimeResult<PreparedDataset>
pub fn prepare_dataset( &self, execution: &Execution, dataset: &Dataset, ) -> RuntimeResult<PreparedDataset>
Prepares a dataset for repeated evaluation with this model.
§Errors
Returns RuntimeError when the dataset cannot be read or cached, its
schema is incompatible, or backend preparation fails.
Sourcepub fn evaluate_prepared(
&self,
execution: &Execution,
params: &ParamValues,
dataset: &PreparedDataset,
source: &Dataset,
) -> RuntimeResult<Vec<Complex64>>
pub fn evaluate_prepared( &self, execution: &Execution, params: &ParamValues, dataset: &PreparedDataset, source: &Dataset, ) -> RuntimeResult<Vec<Complex64>>
Evaluates every event in a prepared dataset while preserving source order.
Backends with a prepared event adapter reuse their retained or streaming prepared blocks. Other backends evaluate the supplied source through the already-selected backend; this operation never substitutes a backend.
§Errors
Returns RuntimeError when model and dataset backends differ, source
streaming fails, or event evaluation fails.
Sourcepub fn evaluate_prepared_many(
&self,
execution: &Execution,
params: &[ParamValues],
dataset: &PreparedDataset,
source: &Dataset,
) -> RuntimeResult<Vec<Vec<Complex64>>>
pub fn evaluate_prepared_many( &self, execution: &Execution, params: &[ParamValues], dataset: &PreparedDataset, source: &Dataset, ) -> RuntimeResult<Vec<Vec<Complex64>>>
Evaluates multiple parameter sets while each prepared event block is active.
Output rows retain parameter-set order and each row retains source-event order.
§Errors
Returns RuntimeError when model and dataset backends differ, source
streaming fails, or event evaluation fails.
Sourcepub fn evaluate_prepared_many_with_reduction(
&self,
execution: &Execution,
params: &[ParamValues],
dataset: &PreparedDataset,
source: &Dataset,
reduction: ReductionPlan,
) -> RuntimeResult<(Vec<Vec<Complex64>>, Vec<f64>)>
pub fn evaluate_prepared_many_with_reduction( &self, execution: &Execution, params: &[ParamValues], dataset: &PreparedDataset, source: &Dataset, reduction: ReductionPlan, ) -> RuntimeResult<(Vec<Vec<Complex64>>, Vec<f64>)>
Evaluates and reduces multiple parameter sets while each prepared block is active.
§Errors
Returns RuntimeError when model and dataset backends differ, source
streaming fails, event evaluation fails, or the reduction rejects a value.
Sourcepub fn reduce(
&self,
execution: &Execution,
params: &ParamValues,
dataset: &PreparedDataset,
reduction: ReductionPlan,
) -> RuntimeResult<f64>
pub fn reduce( &self, execution: &Execution, params: &ParamValues, dataset: &PreparedDataset, reduction: ReductionPlan, ) -> RuntimeResult<f64>
Executes a weighted scalar reduction over a prepared dataset.
§Errors
Returns RuntimeError when model and dataset backends differ, inputs
are incompatible, evaluation fails, or the reduction domain is invalid.
Sourcepub fn reduce_with_gradient(
&self,
execution: &Execution,
params: &ParamValues,
dataset: &PreparedDataset,
reduction: ReductionPlan,
) -> RuntimeResult<ReductionEvaluation>
pub fn reduce_with_gradient( &self, execution: &Execution, params: &ParamValues, dataset: &PreparedDataset, reduction: ReductionPlan, ) -> RuntimeResult<ReductionEvaluation>
Executes a weighted reduction and computes its free-parameter gradient.
§Errors
Returns RuntimeError when model and dataset backends differ,
differentiation or evaluation fails, or the reduction domain is invalid.
Trait Implementations§
Source§impl Clone for PreparedModel
impl Clone for PreparedModel
Source§fn clone(&self) -> PreparedModel
fn clone(&self) -> PreparedModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PreparedModel
impl RefUnwindSafe for PreparedModel
impl Send for PreparedModel
impl Sync for PreparedModel
impl Unpin for PreparedModel
impl UnsafeUnpin for PreparedModel
impl UnwindSafe for PreparedModel
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.