Skip to main content

Hardtanh

Struct Hardtanh 

Source
pub struct Hardtanh<D: Float, T, const RANK: usize> {
    pub min_val: f64,
    pub max_val: f64,
    /* private fields */
}
Expand description

Hardtanh activation layer: clamps input to [min_val, max_val].

Fields§

§min_val: f64

Lower clamp bound.

§max_val: f64

Upper clamp bound.

Implementations§

Source§

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

Source

pub fn new(min_val: f64, max_val: f64) -> Self

Creates a new Hardtanh layer clamping to [min_val, max_val].

Trait Implementations§

Source§

impl<D: Float, const RANK: usize> Layer<SymTensor> for Hardtanh<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 Hardtanh<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 Hardtanh<D, T, RANK>

§

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

§

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

§

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

§

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

§

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

§

impl<D, T, const RANK: usize> UnwindSafe for Hardtanh<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.