Trait nncombinator::activation::Activation
source · pub trait Activation<U, T, R, D>where
U: UnitValue<U>,
D: Device<U>,{
fn apply(&self, device: &D, input: &T) -> Result<R, EvaluateError>;
fn derive(&self, device: &D, o: &T, loss: &T, u: &T) -> Result<R, TrainingError>;
fn is_canonical_link<L: LossFunction<U>>(&self, l: &L) -> bool;
}
Expand description
Trait defining activation functions
Required Methods§
sourcefn apply(&self, device: &D, input: &T) -> Result<R, EvaluateError>
fn apply(&self, device: &D, input: &T) -> Result<R, EvaluateError>
sourcefn derive(&self, device: &D, o: &T, loss: &T, u: &T) -> Result<R, TrainingError>
fn derive(&self, device: &D, o: &T, loss: &T, u: &T) -> Result<R, TrainingError>
Apply derivatives of the activation function
Arguments
device
- Device objects available for processingo
- Input from upper layersloss
- Losses calculated at lower tiersu
- Value before passing through the activation function of the input from the upper layer
Errors
This function may return the following errors