Skip to main content

ForwardExecutor

Trait ForwardExecutor 

Source
pub trait ForwardExecutor<Op: Primitive>
where Op::InputKey: ADKey,
{ // Required methods fn run_linearized_forward( &mut self, linear: &LinearizedGraph<Op>, tangent_in: &[ForwardTangentInput<Op>], external_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>, ctx: &mut Op::ADContext, ) -> ADRuleResult<Vec<Option<Arc<Op::Operand>>>>; fn add_operands( &mut self, a: &Arc<Op::Operand>, b: &Arc<Op::Operand>, ) -> Arc<Op::Operand>; // Provided method fn linearize_recorded_graph( &mut self, graph: &RecordedGraph<Op>, output_slots: &[usize], ctx: &mut Op::ADContext, ) -> ADRuleResult<Arc<LinearizedGraph<Op>>> { ... } }
Expand description

Downstream execution hooks for eager forward-mode AD.

Required Methods§

Source

fn run_linearized_forward( &mut self, linear: &LinearizedGraph<Op>, tangent_in: &[ForwardTangentInput<Op>], external_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>, ctx: &mut Op::ADContext, ) -> ADRuleResult<Vec<Option<Arc<Op::Operand>>>>

Run a linearized graph with concrete tangent seeds.

Source

fn add_operands( &mut self, a: &Arc<Op::Operand>, b: &Arc<Op::Operand>, ) -> Arc<Op::Operand>

Add two concrete operands for tangent accumulation.

Provided Methods§

Source

fn linearize_recorded_graph( &mut self, graph: &RecordedGraph<Op>, output_slots: &[usize], ctx: &mut Op::ADContext, ) -> ADRuleResult<Arc<LinearizedGraph<Op>>>

Linearize one recorded eager graph node for forward-mode propagation.

The default implementation calls RecordedGraph::linearize. Runtime owners may override this to memoize per-node transform results without taking trace traversal ownership away from tidu.

Implementors§