pub struct AbsFunction;Expand description
Absolute value function: f(x) = |x| Subgradient: ∂f(x) = {-1 if x < 0, [-1, 1] if x = 0, 1 if x > 0}
Trait Implementations§
Source§impl Debug for AbsFunction
impl Debug for AbsFunction
Source§impl DynFunction for AbsFunction
impl DynFunction for AbsFunction
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 AbsFunction
Concrete implementations of SerializableFunction for common functions
impl SerializableFunction for AbsFunction
Concrete implementations of SerializableFunction for common functions
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 AbsFunction
impl SubgradientFunction for AbsFunction
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 AbsFunction
impl RefUnwindSafe for AbsFunction
impl Send for AbsFunction
impl Sync for AbsFunction
impl Unpin for AbsFunction
impl UnsafeUnpin for AbsFunction
impl UnwindSafe for AbsFunction
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