Skip to main content

record_eager_op

Function record_eager_op 

Source
pub fn record_eager_op<Op: PrimitiveOp>(
    key_source: &mut impl EagerKeySource<Op>,
    op: Op,
    inputs: &[EagerValue<Op>],
    outputs: &[Arc<Op::Operand>],
) -> Vec<EagerOutput<Op>>
where Op::InputKey: ADKey,
Expand description

Record a concrete eager primitive execution for reverse-mode AD.

The downstream frontend is responsible for executing op and passing its concrete outputs. tidu allocates stable input aliases and output keys, builds saved forward data, constructs input edges, and returns per-output metadata. Multi-output operations share one GradNode; each output receives its own key, and backward_dag seeds the matching output slot by key.

§Examples

let output_data = Arc::new(execute_primal(&op, &input_data));
let traces = tidu::record_eager_op(
    &mut key_source,
    op,
    &input_traces,
    &[output_data.clone()],
);