pub struct ReLUFunction;Expand description
ReLU function: f(x) = max(0, x) Subgradient: ∂f(x) = {0 if x < 0, [0, 1] if x = 0, 1 if x > 0}
Trait Implementations§
Source§impl Debug for ReLUFunction
impl Debug for ReLUFunction
Source§impl DynFunction for ReLUFunction
impl DynFunction for ReLUFunction
Source§fn is_differentiable(&self) -> bool
fn is_differentiable(&self) -> bool
Whether this function is differentiable
Source§fn memory_complexity(&self) -> MemoryComplexity
fn memory_complexity(&self) -> MemoryComplexity
Memory complexity hint for optimization
Source§fn computational_complexity(&self) -> ComputationalComplexity
fn computational_complexity(&self) -> ComputationalComplexity
Computational complexity hint for optimization
Source§fn is_fusable(&self) -> bool
fn is_fusable(&self) -> bool
Whether this function can be fused with others
Source§fn metadata(&self) -> FunctionMetadata
fn metadata(&self) -> FunctionMetadata
Get function metadata for optimization
Source§impl SerializableFunction for ReLUFunction
impl SerializableFunction for ReLUFunction
Source§fn deserialize(data: &[u8]) -> Result<Box<dyn SerializableFunction>>where
Self: Sized,
fn deserialize(data: &[u8]) -> Result<Box<dyn SerializableFunction>>where
Self: Sized,
Deserialize the function from bytes
Source§fn format_version(&self) -> u32
fn format_version(&self) -> u32
Get the function’s serialization format version
Source§impl SubgradientFunction for ReLUFunction
impl SubgradientFunction for ReLUFunction
Source§fn forward<T>(
&self,
_ctx: &mut FunctionContext,
inputs: &[&dyn AutogradTensor<T>],
) -> Result<Vec<Box<dyn AutogradTensor<T>>>>where
T: TensorElement + Float,
fn forward<T>(
&self,
_ctx: &mut FunctionContext,
inputs: &[&dyn AutogradTensor<T>],
) -> Result<Vec<Box<dyn AutogradTensor<T>>>>where
T: TensorElement + Float,
Forward pass computation
Source§fn subgradient<T>(
&self,
_ctx: &mut FunctionContext,
grad_outputs: &[&dyn AutogradTensor<T>],
) -> Result<Vec<Option<SubgradientSet<T>>>>where
T: TensorElement + Float,
fn subgradient<T>(
&self,
_ctx: &mut FunctionContext,
grad_outputs: &[&dyn AutogradTensor<T>],
) -> Result<Vec<Option<SubgradientSet<T>>>>where
T: TensorElement + Float,
Subgradient computation for non-differentiable operations
Returns a set of possible subgradients
Auto Trait Implementations§
impl Freeze for ReLUFunction
impl RefUnwindSafe for ReLUFunction
impl Send for ReLUFunction
impl Sync for ReLUFunction
impl Unpin for ReLUFunction
impl UnsafeUnpin for ReLUFunction
impl UnwindSafe for ReLUFunction
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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