pub struct StepExecutor<E> {
pub inner: E,
pub log: Vec<IntermediateValue>,
/* private fields */
}Expand description
Wraps any TlExecutor and logs IntermediateValue snapshots at each operation.
A snapshot is recorded when at least one active BreakpointCondition triggers.
If no conditions are added no logging occurs; add BreakpointCondition::Always
to capture every step.
Fields§
§inner: EThe inner executor that performs actual computation.
log: Vec<IntermediateValue>Accumulated log of intermediate values.
Implementations§
Source§impl<E> StepExecutor<E>
impl<E> StepExecutor<E>
Sourcepub fn new(inner: E) -> Self
pub fn new(inner: E) -> Self
Create a new StepExecutor wrapping inner with no active conditions.
Sourcepub fn add_condition(&mut self, cond: BreakpointCondition)
pub fn add_condition(&mut self, cond: BreakpointCondition)
Add a breakpoint condition.
Sourcepub fn log(&self) -> &[IntermediateValue]
pub fn log(&self) -> &[IntermediateValue]
View the accumulated log.
Sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Total number of operations executed so far.
Sourcepub fn has_nan_in_log(&self) -> bool
pub fn has_nan_in_log(&self) -> bool
Returns true if any logged entry contains NaN.
Sourcepub fn has_inf_in_log(&self) -> bool
pub fn has_inf_in_log(&self) -> bool
Returns true if any logged entry contains Inf.
Trait Implementations§
Source§impl<E> TlExecutor for StepExecutor<E>
TlExecutor implementation for executors whose tensor type is ArrayD<f64>.
impl<E> TlExecutor for StepExecutor<E>
TlExecutor implementation for executors whose tensor type is ArrayD<f64>.
type Tensor = ArrayBase<OwnedRepr<f64>, Dim<IxDynImpl>>
type Error = <E as TlExecutor>::Error
Source§fn einsum(
&mut self,
spec: &str,
inputs: &[Self::Tensor],
) -> Result<Self::Tensor, Self::Error>
fn einsum( &mut self, spec: &str, inputs: &[Self::Tensor], ) -> Result<Self::Tensor, Self::Error>
Execute an einsum operation on input tensors.
Source§fn elem_op(
&mut self,
op: ElemOp,
x: &Self::Tensor,
) -> Result<Self::Tensor, Self::Error>
fn elem_op( &mut self, op: ElemOp, x: &Self::Tensor, ) -> Result<Self::Tensor, Self::Error>
Apply an element-wise unary operation.
Auto Trait Implementations§
impl<E> Freeze for StepExecutor<E>where
E: Freeze,
impl<E> RefUnwindSafe for StepExecutor<E>where
E: RefUnwindSafe,
impl<E> Send for StepExecutor<E>where
E: Send,
impl<E> Sync for StepExecutor<E>where
E: Sync,
impl<E> Unpin for StepExecutor<E>where
E: Unpin,
impl<E> UnsafeUnpin for StepExecutor<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for StepExecutor<E>where
E: 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
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