Skip to contents

Derivatives Parametric ReLU Activation Function

Usage

dPReLU(x, alpha = 1)

dPReLUa(x, alpha = 1)

dPReLUa1(x, alpha = 1)

Arguments

x

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

alpha

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

Value

A numeric vector where the derivative(s) of the ELU function has been applied to each element of x.

See also

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

Author

Matthew L. Fidler

Examples


dPReLU(c(-1, 0, 1, 2), 2)
#> [1] 2 2 1 1
dPReLUa(c(-1, 0, 1, 2), 2)
#> [1] -1  0  0  0
dPReLUa1(c(-1, 0, 1, 2), 2)
#> [1] 1 1 0 0


# Can also be used in rxode2:
r <- rxode2({
  r1=dPReLU(time, 2)
  r2a=dPReLUa(time, 2)
  ra=dPReLUa1(time, 2)
})
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’

e <- et(c(-1, 0, 1, 2))
rxSolve(r, 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 × 4
#>    time    r1   r2a    ra
#>   <dbl> <dbl> <dbl> <dbl>
#> 1    -1     2    -1     1
#> 2     0     2     0     1
#> 3     1     1     0     0
#> 4     2     1     0     0