pub enum Activation {
Tanh,
Relu,
Sigmoid,
Elu,
Softsign,
Linear,
}Expand description
Supported activation function variants.
Each variant implements apply(x) for the forward pass and
derivative(fx) which takes the post-activation value.
§Examples
use pc_rl_core::activation::Activation;
let act = Activation::Tanh;
let y = act.apply(0.5);
let dy = act.derivative(y);Variants§
Tanh
Hyperbolic tangent: output in (-1, 1).
Relu
Rectified linear unit: max(0, x).
Sigmoid
Logistic sigmoid: output in (0, 1).
Elu
Exponential linear unit: smooth in negatives, avoids dying neurons.
Softsign
Softsign: bounded in (-1, 1) with slower saturation than tanh. Preserves more gradient in high-saturation regions.
Linear
Identity function: output equals input.
Implementations§
Trait Implementations§
Source§impl Clone for Activation
impl Clone for Activation
Source§fn clone(&self) -> Activation
fn clone(&self) -> Activation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Activation
impl Debug for Activation
Source§impl<'de> Deserialize<'de> for Activation
impl<'de> Deserialize<'de> for Activation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Activation
impl PartialEq for Activation
Source§impl Serialize for Activation
impl Serialize for Activation
impl Copy for Activation
impl Eq for Activation
impl StructuralPartialEq for Activation
Auto Trait Implementations§
impl Freeze for Activation
impl RefUnwindSafe for Activation
impl Send for Activation
impl Sync for Activation
impl Unpin for Activation
impl UnsafeUnpin for Activation
impl UnwindSafe for Activation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more