Skip to main content

Softplus

Struct Softplus 

Source
pub struct Softplus<D: Float, T, const RANK: usize> {
    pub beta: f64,
    pub threshold: f64,
    /* private fields */
}
Expand description

Softplus activation layer: a smooth ReLU approximation, (1/beta) * ln(1 + e^(beta*x)), reverting to linear above threshold for numerical stability.

Fields§

§beta: f64

The beta sharpness parameter.

§threshold: f64

Above this value, the layer reverts to linear (x) to avoid overflow in exp.

Implementations§

Source§

impl<D: Float, T, const RANK: usize> Softplus<D, T, RANK>

Source

pub fn new(beta: f64, threshold: f64) -> Self

Creates a new Softplus layer with the given beta/threshold.

Trait Implementations§

Source§

impl<D: Float, const RANK: usize> Layer<SymTensor> for Softplus<D, SymTensor, RANK>

Source§

type Output = SymTensor

This layer’s output type.
Source§

fn call(&self, input: SymTensor) -> SymTensor

Applies this layer to input.
Source§

impl<D: Float, T: Tensor<D, RANK> + EagerTensor, const RANK: usize> Layer<T> for Softplus<D, T, RANK>

Source§

type Output = T

This layer’s output type.
Source§

fn call(&self, _input: T) -> Self::Output

Applies this layer to input.

Auto Trait Implementations§

§

impl<D, T, const RANK: usize> Freeze for Softplus<D, T, RANK>

§

impl<D, T, const RANK: usize> RefUnwindSafe for Softplus<D, T, RANK>

§

impl<D, T, const RANK: usize> Send for Softplus<D, T, RANK>
where D: Send, T: Send,

§

impl<D, T, const RANK: usize> Sync for Softplus<D, T, RANK>
where D: Sync, T: Sync,

§

impl<D, T, const RANK: usize> Unpin for Softplus<D, T, RANK>
where D: Unpin, T: Unpin,

§

impl<D, T, const RANK: usize> UnsafeUnpin for Softplus<D, T, RANK>

§

impl<D, T, const RANK: usize> UnwindSafe for Softplus<D, T, RANK>
where D: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.