pub trait BackwardExecutor<Op: Primitive>where
Op::InputKey: ADKey,{
// Required methods
fn execute_forward(
&mut self,
graph: PrimitiveGraph<'_, Op>,
initial_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>,
) -> HashMap<ValueKey<Op>, Arc<Op::Operand>>;
fn run_transposed_linear(
&mut self,
linear: &LinearizedGraph<Op>,
cotangent_out: &[Option<Arc<Op::Operand>>],
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>;
}Expand description
Downstream execution hooks for eager backward.
Required Methods§
Sourcefn execute_forward(
&mut self,
graph: PrimitiveGraph<'_, Op>,
initial_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>,
) -> HashMap<ValueKey<Op>, Arc<Op::Operand>>
fn execute_forward( &mut self, graph: PrimitiveGraph<'_, Op>, initial_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>, ) -> HashMap<ValueKey<Op>, Arc<Op::Operand>>
Replay a primitive graph and return any concrete values needed by transpose execution.
Sourcefn run_transposed_linear(
&mut self,
linear: &LinearizedGraph<Op>,
cotangent_out: &[Option<Arc<Op::Operand>>],
external_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>,
ctx: &mut Op::ADContext,
) -> ADRuleResult<Vec<Option<Arc<Op::Operand>>>>
fn run_transposed_linear( &mut self, linear: &LinearizedGraph<Op>, cotangent_out: &[Option<Arc<Op::Operand>>], external_data: &HashMap<ValueKey<Op>, Arc<Op::Operand>>, ctx: &mut Op::ADContext, ) -> ADRuleResult<Vec<Option<Arc<Op::Operand>>>>
Run a transposed linear graph with concrete cotangent seeds.
Sourcefn add_operands(
&mut self,
a: &Arc<Op::Operand>,
b: &Arc<Op::Operand>,
) -> Arc<Op::Operand>
fn add_operands( &mut self, a: &Arc<Op::Operand>, b: &Arc<Op::Operand>, ) -> Arc<Op::Operand>
Add two concrete operands for cotangent accumulation.