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§
Sourcefn execute_forward(
&mut self,
fragment: &Fragment<Op>,
initial_data: &HashMap<GlobalValKey<Op>, Arc<Op::Operand>>,
) -> HashMap<GlobalValKey<Op>, Arc<Op::Operand>>
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.
Sourcefn 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 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.
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.