Mish
Copy echoAI.Activation.m_ops.Mish()
Applies the element-wise function:
Mish ( x ) = x tanh ( softplus ( x ) ) \textbf{Mish}(x)=x\tanh(\text{softplus}(x)) Mish ( x ) = x tanh ( softplus ( x )) Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
Swish
Copy echoAI.Activation.m_ops.Swish(eswish = False, swish = True, beta = 1.735, flatten = False)
Allows the following element-wise functions:
Swish ( x ) = x sigmoid ( β 1 x ) \textbf{Swish}(x)=x\text{sigmoid}(\beta_{1} x) Swish ( x ) = x sigmoid ( β 1 x ) ESwish ( x ) = β x sigmoid ( x ) \textbf{ESwish}(x)=\beta x\text{sigmoid}(x) ESwish ( x ) = β x sigmoid ( x ) SILU ( x ) = x sigmoid ( x ) \textbf{SILU}(x)=x\text{sigmoid}(x) SILU ( x ) = x sigmoid ( x ) Flatten T-Swish ( x ) = { x sigmoid ( x ) if x ≥ 0 0 otherwise \textbf{Flatten T-Swish}(x)= \begin{cases}
x\text{sigmoid}(x) & \text{if } x\geq 0\\
0 & \text{otherwise}
\end{cases} Flatten T-Swish ( x ) = { x sigmoid ( x ) 0 if x ≥ 0 otherwise Parameters:
eswish - Uses E-Swish activation function. Default: False
.
swish - Uses Swish activation function. Default: False
.
flatten - Uses Flatten T-Swish activation function. Default: False
.
beta - β \beta β parameter used for E-Swish formulation. Default: 1.375
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
References:
Aria2
Copy echoAI.Activation.m_ops.Aria2(beta = 0.5, alpha = 1.0)
Applies the element-wise function:
Aria2 ( x ) = ( 1 + e − β ∗ x ) − α \textbf{Aria2}(x)= {(1+e^{-\beta \ast x})}^{-\alpha} Aria2 ( x ) = ( 1 + e − β ∗ x ) − α Parameters:
beta -β \beta β is the exponential growth rate. Default: 0.5
alpha -α \alpha α is a hyper-parameter which has a two-fold effect; it reduces the curvature in 3rd quadrant as well as increases the curvature in first quadrant while lowering the value of activation. Default: 1.0
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
ELiSH
Copy echoAI.Activation.m_ops.Elish(hard = False)
Allows the following element-wise functions:
ELiSH ( x ) = { x sigmoid ( x ) if x ≥ 0 ( e x − 1 ) sigmoid ( x ) otherwise \textbf{ELiSH}(x)= \begin{cases}
x\text{sigmoid}(x) & \text{if } x \geq 0\\
(e^{x}-1)\text{sigmoid}(x) & \text{otherwise}
\end{cases} ELiSH ( x ) = { x sigmoid ( x ) ( e x − 1 ) sigmoid ( x ) if x ≥ 0 otherwise Hard ELiSH ( x ) = { x max ( 0 , min ( 1 , ( x + 1 ) / 2 ) ) if x ≥ 0 ( e x − 1 ) max ( 0 , min ( 1 , ( x + 1 ) / 2 ) ) otherwise \textbf{Hard ELiSH}(x)= \begin{cases}
x\max(0, \min(1,(x+1)/2)) & \text{if } x \geq 0\\
(e^{x}-1)\max(0, \min(1,(x+1)/2)) & \text{otherwise}
\end{cases} Hard ELiSH ( x ) = { x max ( 0 , min ( 1 , ( x + 1 ) /2 )) ( e x − 1 ) max ( 0 , min ( 1 , ( x + 1 ) /2 )) if x ≥ 0 otherwise Parameter:
hard - Uses Hard ELiSH activation function. Default: False
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
ISRU
Copy echoAI.Activation.m_ops.ISRU(alpha = 1.0, isrlu = False)
Allows the following element-wise functions:
ISRU ( x ) = x 1 + α x 2 \textbf{ISRU}(x)= \frac{x}{\sqrt{1+\alpha x^{2}}} ISRU ( x ) = 1 + α x 2 x ISRLU ( x ) = { x if x ≥ 0 x 1 + α x 2 otherwise \textbf{ISRLU}(x)= \begin{cases}
x & \text{if } x \geq 0\\
\frac{x}{\sqrt{1+\alpha x^{2}}} & \text{otherwise}
\end{cases} ISRLU ( x ) = { x 1 + α x 2 x if x ≥ 0 otherwise Parameters:
alpha - hyperparameterα \alpha α controls the value to which an ISRLU saturates for negative inputs. Default: 1.0
isrlu - Uses ISRLU activation function. Default: False
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
NLReLU
Copy echoAI.Activation.m_ops.NLReLU(beta = 1.0)
Applies the element-wise function:
NLReLU ( x ) = ln ( β max ( 0 , x ) + 1.0 ) \textbf{NLReLU}(x)= \ln(\beta\max(0,x)+1.0) NLReLU ( x ) = ln ( β max ( 0 , x ) + 1.0 ) Parameters:
beta - β \beta β parameter used for NLReLU formulation. Default: 1.0
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
Soft Clipping
Copy echoAI.Activation.m_ops.SoftClipping(alpha = 0.5)
Applies the element-wise function:
Soft Clipping ( x ) = 1 α log ( 1 + e α x 1 + e α ( x − 1 ) ) \textbf{Soft Clipping}(x)= \frac{1}{\alpha}\log{\big(\frac{1+e^{\alpha x}}{1+e^{\alpha (x-1)}}\big)} Soft Clipping ( x ) = α 1 log ( 1 + e α ( x − 1 ) 1 + e αx ) Parameters:
alpha -α \alpha α hyper-parameter, which determines how close to linear the central region is and how sharply the linear region turns to the asymptotic values. Default: 0.5
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
Soft Exponential
Copy echoAI.Activation.m_ops.SoftExponential(alpha = None)
Applies the element-wise function:
Soft Exponential ( x ) = { − log ( 1 + α ( x + α ) ) α if α < 0 x if α = 0 e α x − 1 α if α > 0 \textbf{Soft Exponential}(x)= \begin{cases}
\frac{-\log{(1+\alpha(x + \alpha))}}{\alpha} & \text{if } \alpha < 0\\
x & \text{if } \alpha = 0\\
\frac{e^{\alpha x}-1}{\alpha} & \text{if } \alpha > 0
\end{cases} Soft Exponential ( x ) = ⎩ ⎨ ⎧ α − l o g ( 1 + α ( x + α )) x α e αx − 1 if α < 0 if α = 0 if α > 0 Parameters:
alpha -α \alpha α trainable hyper-parameter which is initialized to zero by default. Default: None
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
SQNL
Copy echoAI.Activation.m_ops.SQNL()
Applies the element-wise function:
SQNL ( x ) = { 1 if x > 2 x − x 2 4 if 0 ≤ x ≤ 2 x + x 2 4 if − 2 ≤ x < 0 − 1 if x < − 2 \textbf{SQNL}(x)= \begin{cases}
1 & \text{if } x > 2\\
x - \frac{x^2}{4} & \text{if } 0 \leq x \leq 2\\
x + \frac{x^2}{4} & \text{if } -2 \leq x < 0\\
-1 & \text{if } x < -2
\end{cases} SQNL ( x ) = ⎩ ⎨ ⎧ 1 x − 4 x 2 x + 4 x 2 − 1 if x > 2 if 0 ≤ x ≤ 2 if − 2 ≤ x < 0 if x < − 2 Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
SReLU
Copy echoAI.Activation.m_ops.SReLU(in_features, parameters = None)
Applies the element-wise function:
SReLU ( x i ) = { t i r + a i r ( x i − t i r ) if x i ≥ t i r x i if t i r > x i > t i l t i l + a i l ( x i − t i l ) x i ≤ t i l \textbf{SReLU}(x_{i})= \begin{cases}
t_i^r + a_i^r(x_i - t_i^r) & \text{if } x_i \geq t_i^r\\
x_i & \text{if } t_i^r > x_i > t_i^l\\
t_i^l + a_i^l(x_i - t_i^l) & x_i \leq t_i^l
\end{cases} SReLU ( x i ) = ⎩ ⎨ ⎧ t i r + a i r ( x i − t i r ) x i t i l + a i l ( x i − t i l ) if x i ≥ t i r if t i r > x i > t i l x i ≤ t i l Parameters:
in_features - Shape of the input. Datatype: Tuple
parameters - ( t r , t l , a r , a l t^r,t^l,a^r,a^l t r , t l , a r , a l ) parameters for manual initialization, Default: None
. If None
is passed, parameters are initialized randomly.
Shape:
Input:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) where∗ \ast ∗ means any number of additional dimensions
Output:( N , ∗ ) (\mathbf{N}, \ast) ( N , ∗ ) , same shape as input
Reference:
FReLU
Copy echoAI.Activation.m_ops.FReLU(in_channels)
Applies the element-wise function:
FReLU ( x ) = max ( x , T ( x ) ) \textbf{FReLU}(x)= \max(x,\mathbb{T}(x)) FReLU ( x ) = max ( x , T ( x )) Parameter:
in_channels - Number of channels in the input tensor. Datatype: Integer
Shape:
Input:( N , C , H , W ) (\mathbf{N}, \mathbf{C}, \mathbf{H}, \mathbf{W}) ( N , C , H , W ) whereC \mathbf{C} C indicates the number of channels.
Output:( N , C , H , W ) (\mathbf{N}, \mathbf{C}, \mathbf{H}, \mathbf{W}) ( N , C , H , W ) , same shape as input
Reference: