Skip to main content

ADKey

Trait ADKey 

Source
pub trait ADKey:
    Clone
    + Debug
    + Hash
    + Eq
    + Send
    + Sync
    + 'static {
    // Required method
    fn tangent_of(&self, pass: DiffPassId) -> Self;
}
Expand description

Constraint on GraphOperation::InputKey for AD use.

tidu uses this trait to generate tangent input keys during crate::linearize.

§Examples

use tidu::{ADKey, DiffPassId};

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
enum MyKey {
    User(String),
    Tangent { of: Box<MyKey>, pass: DiffPassId },
}

impl ADKey for MyKey {
    fn tangent_of(&self, pass: DiffPassId) -> Self {
        MyKey::Tangent {
            of: Box::new(self.clone()),
            pass,
        }
    }
}

Required Methods§

Source

fn tangent_of(&self, pass: DiffPassId) -> Self

Create a tangent input key derived from this key. pass is a unique identifier for the linearize call.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§