Skip to main content

EagerKeySource

Trait EagerKeySource 

Source
pub trait EagerKeySource<Op: GraphOp> {
    // Required method
    fn fresh_input_key(&mut self) -> Op::InputKey;
}
Expand description

Caller-provided source of stable eager value keys.

tidu wraps each fresh input key in GlobalValKey::Input. This guarantees the aliases recorded in GradNode::primal_in_keys satisfy the current single-op backward replay model.

§Examples

impl tidu::EagerKeySource<MyOp> for MyKeySource {
    fn fresh_input_key(&mut self) -> MyInputKey {
        self.next_key()
    }
}

Required Methods§

Source

fn fresh_input_key(&mut self) -> Op::InputKey

Return a fresh input key that has not been used for another eager value.

Implementors§