Skip to main content

StepExecutor

Struct StepExecutor 

Source
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: E

The inner executor that performs actual computation.

§log: Vec<IntermediateValue>

Accumulated log of intermediate values.

Implementations§

Source§

impl<E> StepExecutor<E>

Source

pub fn new(inner: E) -> Self

Create a new StepExecutor wrapping inner with no active conditions.

Source

pub fn add_condition(&mut self, cond: BreakpointCondition)

Add a breakpoint condition.

Source

pub fn log(&self) -> &[IntermediateValue]

View the accumulated log.

Source

pub fn step_count(&self) -> usize

Total number of operations executed so far.

Source

pub fn clear_log(&mut self)

Clear the accumulated log (step count is not reset).

Source

pub fn has_nan_in_log(&self) -> bool

Returns true if any logged entry contains NaN.

Source

pub fn has_inf_in_log(&self) -> bool

Returns true if any logged entry contains Inf.

Source

pub fn summary(&self) -> String

One-line human-readable summary of the execution log.

Trait Implementations§

Source§

impl<E> TlExecutor for StepExecutor<E>
where E: TlExecutor<Tensor = ArrayD<f64>>,

TlExecutor implementation for executors whose tensor type is ArrayD<f64>.

Source§

type Tensor = ArrayBase<OwnedRepr<f64>, Dim<IxDynImpl>>

Source§

type Error = <E as TlExecutor>::Error

Source§

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>

Apply an element-wise unary operation.
Source§

fn elem_op_binary( &mut self, op: ElemOp, x: &Self::Tensor, y: &Self::Tensor, ) -> Result<Self::Tensor, Self::Error>

Apply an element-wise binary operation.
Source§

fn reduce( &mut self, op: ReduceOp, x: &Self::Tensor, axes: &[usize], ) -> Result<Self::Tensor, Self::Error>

Reduce a tensor along specified axes.

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> 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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V