pub trait Activation<U, T, R, D>{
// Required methods
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
Sourcefn is_canonical_link<L: LossFunction<U>>(&self, l: &L) -> bool
fn is_canonical_link<L: LossFunction<U>>(&self, l: &L) -> bool
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.