pub enum ActivationOp {
Sigmoid,
Silu,
Softplus,
Gelu,
GeluTanh,
}Expand description
Fused real-float activation applied in one elementwise pass.
The variants name the same functions the composite activation vocabulary exposes; a backend that supports the fused form computes the whole expression in one traversal instead of materializing every intermediate.
§Examples
use tenferro_tensor::ActivationOp;
assert_eq!(ActivationOp::Sigmoid.label(), "sigmoid");Variants§
Sigmoid
Logistic sigmoid 1 / (1 + exp(-x)), overflow-free.
Silu
SiLU / swish x * sigmoid(x).
Softplus
Softplus max(x, 0) + log1p(exp(-|x|)).
Gelu
Exact GELU x/2 * (1 + erf(x / sqrt(2))).
GeluTanh
GELU tanh approximation x/2 * (1 + tanh(sqrt(2/pi) * (x + 0.044715 x^3))).
Trait Implementations§
Source§impl Clone for ActivationOp
impl Clone for ActivationOp
Source§fn clone(&self) -> ActivationOp
fn clone(&self) -> ActivationOp
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ActivationOp
Source§impl Debug for ActivationOp
impl Debug for ActivationOp
impl Eq for ActivationOp
Source§impl PartialEq for ActivationOp
impl PartialEq for ActivationOp
impl StructuralPartialEq for ActivationOp
Auto Trait Implementations§
impl Freeze for ActivationOp
impl RefUnwindSafe for ActivationOp
impl Send for ActivationOp
impl Sync for ActivationOp
impl Unpin for ActivationOp
impl UnsafeUnpin for ActivationOp
impl UnwindSafe for ActivationOp
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