Struct MLCActivationType

Source
#[repr(transparent)]
pub struct MLCActivationType(pub i32);
Available on crate feature MLCTypes only.
Expand description

An activation type that you specify for an activation descriptor.

See also Apple’s documentation

Tuple Fields§

§0: i32

Implementations§

Source§

impl MLCActivationType

Source

pub const None: Self

The identity activation type.

Source

pub const ReLU: Self

The ReLU activation type.

This activation type implements the following function:

  f(x) = x >= 0 ? x : a * x
Source

pub const Linear: Self

The linear activation type.

This activation type implements the following function:

  f(x) = a * x + b
Source

pub const Sigmoid: Self

The sigmoid activation type.

This activation type implements the following function:

  f(x) = 1 / (1 + e⁻ˣ)
Source

pub const HardSigmoid: Self

The hard sigmoid activation type.

This activation type implements the following function:

  f(x) = clamp((x * a) + b, 0, 1)
Source

pub const Tanh: Self

The hyperbolic tangent (TanH) activation type.

This activation type implements the following function:

  f(x) = a * tanh(b * x)
Source

pub const Absolute: Self

The absolute activation type.

This activation type implements the following function:

  f(x) = fabs(x)
Source

pub const SoftPlus: Self

The parametric soft plus activation type.

This activation type implements the following function:

  f(x) = a * log(1 + e^(b * x))
Source

pub const SoftSign: Self

The parametric soft sign activation type.

This activation type implements the following function:

  f(x) = x / (1 + abs(x))
  \endcod
      
Source

pub const ELU: Self

The parametric ELU activation type.

This activation type implements the following function:

  f(x) = x >= 0 ? x : a * (exp(x) - 1)
Source

pub const ReLUN: Self

The ReLUN activation type.

This activation type implements the following function:

  f(x) = min((x >= 0 ? x : a * x), b)
Source

pub const LogSigmoid: Self

The log sigmoid activation type.

This activation type implements the following function:

  f(x) = log(1 / (1 + exp(-x)))
Source

pub const SELU: Self

The SELU activation type.

This activation type implements the following function:

  f(x) = scale * (max(0, x) + min(0, α * (exp(x) − 1)))

where:

  α = 1.6732632423543772848170429916717
  scale = 1.0507009873554804934193349852946
Source

pub const CELU: Self

The CELU activation type.

This activation type implements the following function:

  f(x) = max(0, x) + min(0, a * (exp(x / a) − 1))
Source

pub const HardShrink: Self

The hard shrink activation type.

This activation type implements the following function:

  f(x) = x, if x > a or x < −a, else 0
Source

pub const SoftShrink: Self

The soft shrink activation type.

This activation type implements the following function:

  f(x) = x - a, if x > a, x + a, if x < −a, else 0
Source

pub const TanhShrink: Self

The hyperbolic tangent (TanH) shrink activation type.

This activation type implements the following function:

  f(x) = x - tanh(x)
Source

pub const Threshold: Self

The threshold activation type.

This activation type implements the following function:

  f(x) = x, if x > a, else b
Source

pub const GELU: Self

The GELU activation type.

This activation type implements the following function:

  f(x) = x * CDF(x)
Source

pub const HardSwish: Self

The hardswish activation type.

This activation type implements the following function:

  f(x) = 0, if x <= -3
  f(x) = x, if x >= +3
  f(x) = x * (x + 3)/6, otherwise
Source

pub const Clamp: Self

The clamp activation type.

This activation type implements the following function:

  f(x) = min(max(x, a), b)
Source

pub const Count: Self

The clamp activation type.

This activation type implements the following function:

  f(x) = min(max(x, a), b)
Source§

impl MLCActivationType

Source

pub unsafe fn debug_description(self: MLCActivationType) -> Retained<NSString>

Returns a textual description of the activation type, suitable for debugging.

Trait Implementations§

Source§

impl Clone for MLCActivationType

Source§

fn clone(&self) -> MLCActivationType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MLCActivationType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Encode for MLCActivationType

Source§

const ENCODING: Encoding = i32::ENCODING

The Objective-C type-encoding for this type.
Source§

impl Hash for MLCActivationType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for MLCActivationType

Source§

fn cmp(&self, other: &MLCActivationType) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for MLCActivationType

Source§

fn eq(&self, other: &MLCActivationType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for MLCActivationType

Source§

fn partial_cmp(&self, other: &MLCActivationType) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RefEncode for MLCActivationType

Source§

const ENCODING_REF: Encoding

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl Copy for MLCActivationType

Source§

impl Eq for MLCActivationType

Source§

impl StructuralPartialEq for MLCActivationType

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> EncodeArgument for T
where T: Encode,

Source§

const ENCODING_ARGUMENT: Encoding = T::ENCODING

The Objective-C type-encoding for this type.
Source§

impl<T> EncodeReturn for T
where T: Encode,

Source§

const ENCODING_RETURN: Encoding = T::ENCODING

The Objective-C type-encoding for this type.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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