Skip to contents

This function applies the derivative of the Rectified Linear Unit (ReLU) activation function to the input numeric vector.

Usage

dReLU(x)

Arguments

x

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

Value

A numeric vector where the derivative of the ReLU function

See also

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

Examples


dReLU(c(-1, 0, 1, 2))
#> [1] 0 0 1 1

# Can also be used in rxode2:
x <- rxode2({
   r=dReLU(time)
})
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.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
#> 2     0     0
#> 3     1     1
#> 4     2     1