1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
/// An interface for differentiable transformations.
pub trait Transform<T: ?Sized> {
    type Output;

    /// Return the value of the transform for input `x`.
    fn transform(&self, x: T) -> Self::Output;

    /// Return the gradient of the transform for input `x`.
    fn grad(&self, x: T) -> T;
}

pub type EndoTransform<T> = Transform<T, Output = T>;

import_all!(tanh);
import_all!(identity);
import_all!(softplus);
import_all!(logistic);
import_all!(exponential);