pub struct ReLU;Expand description
Rectified Linear Unit (ReLU) activation function.
Outputs the input directly if it is positive; otherwise, it outputs zero.
§Mathematical Definition
For an input x, the ReLU function is defined as:
\text{ReLU}(x) = \max(x, 0)or
\text{ReLU}(x) = \left\{
\begin{array}{ll}
x & \text{if } x \geq 0 \\
0 & \text{if } x < 0
\end{array}
\right.§See Also
Implementations§
Trait Implementations§
Source§impl<T: Float> Function<T> for ReLU
impl<T: Float> Function<T> for ReLU
Source§fn derivative(&self, matrix: Matrix<T>) -> Matrix<T>
fn derivative(&self, matrix: Matrix<T>) -> Matrix<T>
§Derivative of Relu
ReLU'(x) = \left\{
\begin{array}{ll}
1 & \text{if } x \geq 0 \\
0 & \text{if } x < 0
\end{array}
\right.fn name(&self) -> String
Source§fn call(&self, matrix: Matrix<T>) -> Matrix<T>
fn call(&self, matrix: Matrix<T>) -> Matrix<T>
Applies the function to the input matrix. Read more
fn is_linear(&self) -> bool
fn get_data(&self) -> Option<Matrix<T>>
fn set_data(&mut self, _data: Matrix<T>)
fn get_weights(&self) -> Option<Matrix<T>>
fn get_bias(&self) -> Option<Matrix<T>>
fn is_bias(&self) -> bool
Auto Trait Implementations§
impl Freeze for ReLU
impl RefUnwindSafe for ReLU
impl Send for ReLU
impl Sync for ReLU
impl Unpin for ReLU
impl UnwindSafe for ReLU
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> 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