Skip to contents

Element-wise ReLU (Rectified Linear Unit) function on numeric vectors (or objects which can be coerced to them).

Usage

# S3 method for default
relu(x)

Arguments

x

numeric vectors or objects which can be coerced to such.

Value

Vector or array containing the element-wise ReLU of x.

Details

The ReLU function (Fukushima 1975) is defined as follows: relu(x) returns 0 if x < 0, x if x >= 0.

References

Fukushima K (1975). “Cognitron: A self-organizing multilayered neural network.” Biological Cybernetics, 20(3), 121--136. ISSN 1432-0770, doi:10.1007/BF00342633 .

Author

Chloe Serre-Combe, Amelie Vernay

Examples

relu(4)
#> [1] 4
relu(-10:10)
#>  [1]  0  0  0  0  0  0  0  0  0  0  0  1  2  3  4  5  6  7  8  9 10