pub struct LeakyReLU { /* private fields */ }
Expand description
Leaky Rectified Linear Unit (LeakyReLU) activation function.
The LeakyReLU function is similar to ReLU but allows a small, non-zero gradient when the unit is not active: f(x) = max(alphax, x) or f(x) = x if x > 0, alphax otherwise
§Examples
use scirs2_neural::activations::LeakyReLU;
use scirs2_neural::activations::Activation;
use ndarray::Array;
let leaky_relu = LeakyReLU::new(0.01);
let input = Array::from_vec(vec![1.0, -1.0, 2.0, -2.0]).into_dyn();
let output = leaky_relu.forward(&input).unwrap();
assert_eq!(output, Array::from_vec(vec![1.0, -0.01, 2.0, -0.02]).into_dyn());
Implementations§
Trait Implementations§
Source§impl<F: Float + Debug> Activation<F> for LeakyReLU
impl<F: Float + Debug> Activation<F> for LeakyReLU
impl Copy for LeakyReLU
Auto Trait Implementations§
impl Freeze for LeakyReLU
impl RefUnwindSafe for LeakyReLU
impl Send for LeakyReLU
impl Sync for LeakyReLU
impl Unpin for LeakyReLU
impl UnwindSafe for LeakyReLU
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more