Skip to contents

Derivative of the Swish Activation Function

Usage

dSwish(x)

Arguments

x

A numeric vector. All elements must be finite and non-missing.

Value

A numeric vector where the derivative of the SELU function has been applied to each element of x.

See also

Other Activation Functions: ELU(), GELU(), PReLU(), ReLU(), SELU(), Swish(), dELU(), dGELU(), dPReLU(), dReLU(), dSELU(), dlReLU(), dsoftplus(), lReLU(), softplus()

Author

Matthew Fidler

Examples

dSwish(c(-1, 0, 1, 2))
#> [1] 0.07232949 0.50000000 0.92767051 1.09078425

# Can also be used in rxode2:
x <- rxode2({
  r <- dSwish(time)
})
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
e <- et(c(-1, 0, 1, 2))
rxSolve(x, e)
#> ── Solved rxode2 object ──
#> ── Parameters (value$params): ──
#> # A tibble: 1 × 0
#> ── Initial Conditions (value$inits): ──
#> named numeric(0)
#> ── First part of data (object): ──
#> # A tibble: 4 × 2
#>    time      r
#>   <dbl>  <dbl>
#> 1    -1 0.0723
#> 2     0 0.5   
#> 3     1 0.928 
#> 4     2 1.09