pub struct LayerwiseRuntime<A, B, S, P>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
S: RuntimeState<B>,
A: LayeredArchitecture<B, S>,
P: LayerwisePolicy<B, A::Unit>,{ /* private fields */ }Expand description
Bounded-unit runtime invoking the same architecture lifecycle as resident execution.
Implementations§
Source§impl<A, B, S, P> LayerwiseRuntime<A, B, S, P>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
S: RuntimeState<B>,
A: LayeredArchitecture<B, S>,
P: LayerwisePolicy<B, A::Unit>,
A::Error: Display,
P::Error: Display,
impl<A, B, S, P> LayerwiseRuntime<A, B, S, P>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
S: RuntimeState<B>,
A: LayeredArchitecture<B, S>,
P: LayerwisePolicy<B, A::Unit>,
A::Error: Display,
P::Error: Display,
Sourcepub const fn new(architecture: A, policy: P) -> Self
pub const fn new(architecture: A, policy: P) -> Self
Creates a layerwise runtime from concrete architecture, state, and policy.
Sourcepub const fn new_policy_first(policy: P, architecture: A) -> Self
pub const fn new_policy_first(policy: P, architecture: A) -> Self
Creates a layerwise runtime while evaluating the policy before moving the architecture. This is useful when policy realization needs to borrow the architecture’s canonical unit constructor first.
Sourcepub const fn architecture(&self) -> &A
pub const fn architecture(&self) -> &A
Borrows the concrete architecture instance.
Sourcepub fn architecture_mut(&mut self) -> &mut A
pub fn architecture_mut(&mut self) -> &mut A
Mutably borrows the concrete architecture instance.
Sourcepub const fn policy(&self) -> &P
pub const fn policy(&self) -> &P
Borrows the concrete execution policy for cold-path diagnostics.
Sourcepub fn policy_mut(&mut self) -> &mut P
pub fn policy_mut(&mut self) -> &mut P
Mutably borrows the concrete execution policy.
Sourcepub fn forward<'a>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward<'a>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, ) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
Runs one complete prefill or decode pass with exact unit release points.
Sourcepub fn forward_with_context_hook<'a, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
hook: H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_context_hook<'a, H>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, hook: H, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs one pass and exposes mutable architecture context after each unit.
Sourcepub fn forward_with_unit_executor<'a, E>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
execute: E,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_unit_executor<'a, E>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, execute: E, ) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
Runs one pass with a statically dispatched architecture-unit executor.
Composition can use this cold API to inject routed expert execution or observation while the runtime retains graph traversal, residency, and exact completion ownership.
Sourcepub fn forward_with_observer<'a, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_observer<'a, Observer>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, observer: &mut Observer, ) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
Runs the production sequential traversal with stable unit-boundary observation.
Sourcepub fn forward_with_observer_and_context<'a, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_observer_and_context<'a, Observer>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, observer: &mut Observer, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs observed sequential traversal and retains architecture forward resources for the caller’s completion boundary.
Sourcepub fn forward_with_unit_executor_and_observer<'a, E, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
execute: E,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_unit_executor_and_observer<'a, E, Observer>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, execute: E, observer: &mut Observer, ) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
Runs a custom production unit executor with stable boundary observation.
Sourcepub fn forward_with_unit_executor_and_observer_and_context<'a, E, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
execute: E,
observer: &mut Observer,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_unit_executor_and_observer_and_context<'a, E, Observer>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, execute: E, observer: &mut Observer, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs a custom observed executor while returning its retained forward resources.
Sourcepub fn forward_with_provider_and_observer<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_with_provider_and_observer<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs canonical provider-backed unit execution with unit-boundary and routed-expert observation.
Observation wraps RoutedLayeredArchitecture::forward_unit_with_provider
instead of replacing it. Architecture-owned validation, state lookup,
shape handling, routing, and provider dispatch therefore remain shared
with ordinary execution.
Sourcepub fn forward_with_provider_and_observer_and_context<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_with_provider_and_observer_and_context<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs provider-backed observed execution while retaining architecture forward resources.
Sourcepub fn forward_with_inferred_provider_and_observer<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_with_inferred_provider_and_observer<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs provider-backed observed execution with architecture-owned pass classification.
Sourcepub fn forward_with_inferred_provider_and_observer_and_context<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_with_inferred_provider_and_observer_and_context<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
provider: &mut Provider,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: RoutedLayeredArchitecture<B, S>,
A::Error: Display,
Provider: RoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs provider-backed observed execution with architecture-owned pass classification while retaining forward resources.
Sourcepub fn forward_with_unit_executor_and_context_hook<'a, E, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
execute: E,
hook: H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_unit_executor_and_context_hook<'a, E, H>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, execute: E, hook: H, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs one pass with both a custom unit executor and post-unit context hook.
Sourcepub fn forward_with_unit_executor_and_activation_hook<'a, E, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
execute: E,
hook: H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_unit_executor_and_activation_hook<'a, E, H>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, execute: E, hook: H, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs one pass with a custom unit executor and exposes each post-unit activation together with the mutable architecture context.
The activation is the ordinary output of the execution unit. Target state taps and inspection therefore observe the production forward without requiring a second family-specific model path.
Sourcepub fn forward_with_traversal_hook<'a, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
hook: &mut H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_traversal_hook<'a, H>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, hook: &mut H, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs one bounded pass through a statically dispatched traversal hook.
Sourcepub fn forward_with_unit_executor_and_traversal_hook<'a, E, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
context: &<B::Tensor as Tensor>::Context,
execute: E,
hook: &mut H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_with_unit_executor_and_traversal_hook<'a, E, H>( &mut self, input: A::Input<'a>, state: &mut S, context: &<B::Tensor as Tensor>::Context, execute: E, hook: &mut H, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs one bounded pass with custom unit execution and a shared traversal hook.
Sourcepub fn forward_parallel<'a>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
pub fn forward_parallel<'a>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
Runs one complete rank-local pass through the neutral parallel lifecycle.
Sourcepub fn forward_parallel_with_context_hook<'a, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
hook: H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
H: FnMut(usize, usize, &mut A::ForwardContext) -> Result<(), A::Error>,
pub fn forward_parallel_with_context_hook<'a, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
hook: H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
H: FnMut(usize, usize, &mut A::ForwardContext) -> Result<(), A::Error>,
Runs one rank-local pass and exposes mutable context after each unit.
Sourcepub fn forward_parallel_with_unit_executor<'a, E>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
execute: E,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_parallel_with_unit_executor<'a, E>( &mut self, input: A::Input<'a>, state: &mut S, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, execute: E, ) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>
Runs one parallel pass with a custom statically dispatched unit executor.
Sourcepub fn forward_parallel_with_observer<'a, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_parallel_with_observer<'a, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs the production parallel traversal with stable unit-boundary observation.
Sourcepub fn forward_parallel_with_unit_executor_and_observer<'a, E, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
execute: E,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
E: FnMut(&mut A, usize, usize, &mut A::Unit, &B::Tensor, &mut S, &mut A::ForwardContext, &B::ParallelContext, &<B::Tensor as Tensor>::Context) -> Result<B::Tensor, A::Error>,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_parallel_with_unit_executor_and_observer<'a, E, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
execute: E,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
E: FnMut(&mut A, usize, usize, &mut A::Unit, &B::Tensor, &mut S, &mut A::ForwardContext, &B::ParallelContext, &<B::Tensor as Tensor>::Context) -> Result<B::Tensor, A::Error>,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs a custom parallel unit executor with stable boundary observation.
Sourcepub fn forward_parallel_with_provider_and_observer<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
provider: &mut Provider,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: ParallelRoutedLayeredArchitecture<B, S>,
Provider: TensorParallelRoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
pub fn forward_parallel_with_provider_and_observer<'a, Provider, Observer>(
&mut self,
input: A::Input<'a>,
state: &mut S,
pass: ExpertPass,
provider: &mut Provider,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
observer: &mut Observer,
) -> Result<B::Tensor, LayerwiseRuntimeError<A::Error, P::Error>>where
B: GroupedNeuralBackend,
A: ParallelRoutedLayeredArchitecture<B, S>,
Provider: TensorParallelRoutedExpertProvider<B>,
Provider::Error: Display,
Observer: ActivationObserver<B::Tensor, A::Error> + ?Sized,
Runs provider-backed parallel execution with boundary and routing observation.
Sourcepub fn forward_parallel_with_unit_executor_and_context_hook<'a, E, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
execute: E,
hook: H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
pub fn forward_parallel_with_unit_executor_and_context_hook<'a, E, H>( &mut self, input: A::Input<'a>, state: &mut S, parallel: &B::ParallelContext, context: &<B::Tensor as Tensor>::Context, execute: E, hook: H, ) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>
Runs one parallel pass with custom unit execution and a post-unit hook.
Sourcepub fn forward_parallel_with_traversal_hook<'a, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
hook: &mut H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
H: LayeredTraversalHook<B, A::ForwardContext, A::Error> + ?Sized,
pub fn forward_parallel_with_traversal_hook<'a, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
hook: &mut H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
H: LayeredTraversalHook<B, A::ForwardContext, A::Error> + ?Sized,
Runs one parallel pass through a statically dispatched traversal hook.
Sourcepub fn forward_parallel_with_unit_executor_and_traversal_hook<'a, E, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
execute: E,
hook: &mut H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
E: FnMut(&mut A, usize, usize, &mut A::Unit, &B::Tensor, &mut S, &mut A::ForwardContext, &B::ParallelContext, &<B::Tensor as Tensor>::Context) -> Result<B::Tensor, A::Error>,
H: LayeredTraversalHook<B, A::ForwardContext, A::Error> + ?Sized,
pub fn forward_parallel_with_unit_executor_and_traversal_hook<'a, E, H>(
&mut self,
input: A::Input<'a>,
state: &mut S,
parallel: &B::ParallelContext,
context: &<B::Tensor as Tensor>::Context,
execute: E,
hook: &mut H,
) -> Result<(B::Tensor, A::ForwardContext), LayerwiseRuntimeError<A::Error, P::Error>>where
A: ParallelLayeredArchitecture<B, S>,
E: FnMut(&mut A, usize, usize, &mut A::Unit, &B::Tensor, &mut S, &mut A::ForwardContext, &B::ParallelContext, &<B::Tensor as Tensor>::Context) -> Result<B::Tensor, A::Error>,
H: LayeredTraversalHook<B, A::ForwardContext, A::Error> + ?Sized,
Runs one parallel pass with custom unit execution and a shared traversal hook.