Skip to main content

BackwardCallbacks

Trait BackwardCallbacks 

Source
pub trait BackwardCallbacks<Op: PrimitiveOp>
where Op::InputKey: ADKey,
{ // Required methods fn execute_forward( &mut self, fragment: &Fragment<Op>, initial_data: &HashMap<GlobalValKey<Op>, Arc<Op::Operand>>, ) -> HashMap<GlobalValKey<Op>, Arc<Op::Operand>>; fn eager_transpose( &mut self, linear: &LinearFragment<Op>, cotangent_out: &[Option<Arc<Op::Operand>>], external_data: &HashMap<GlobalValKey<Op>, Arc<Op::Operand>>, ctx: &mut Op::ADContext, ) -> Vec<Option<Arc<Op::Operand>>>; fn add_operands( &mut self, a: &Arc<Op::Operand>, b: &Arc<Op::Operand>, ) -> Arc<Op::Operand>; }
Expand description

Caller-provided execution hooks for eager backward.

Required Methods§

Source

fn execute_forward( &mut self, fragment: &Fragment<Op>, initial_data: &HashMap<GlobalValKey<Op>, Arc<Op::Operand>>, ) -> HashMap<GlobalValKey<Op>, Arc<Op::Operand>>

Execute a linear fragment forward and return any concrete values needed by eager transpose.

Source

fn eager_transpose( &mut self, linear: &LinearFragment<Op>, cotangent_out: &[Option<Arc<Op::Operand>>], external_data: &HashMap<GlobalValKey<Op>, Arc<Op::Operand>>, ctx: &mut Op::ADContext, ) -> Vec<Option<Arc<Op::Operand>>>

Execute transpose eagerly for a linear fragment with concrete seeds.

Source

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

Add two concrete operands for cotangent accumulation.

Implementors§