Learn R Programming

modello (version 0.1.1)

relu.modello_number: ReLU

Description

Calculates the relu fucntion $$relu = max(0, x)$$

Usage

# S3 method for modello_number
relu(x)

# S3 method for default relu(x)

relu(x)

Arguments

x

a 'numeric' or a reference object of class 'number'

Value

Returns a 'numeric' or reference object of class 'number'

Examples

Run this code
# NOT RUN {
modello.init(10, 10, 10, 10)
## For modello_numbers sclars
x1 = number(rnorm(1), scalar=TRUE)
y1 = relu(x1)
print(y1)
print(y1$v)
## For modello_number arrays 
x2 = number(matrix(rnorm(9), 3, 3))
y2 = relu(x2)
print(y2)
print(y2$v)
modello.close()
## For numeric sclars
x1 = rnorm(1)
y1 = relu(x1)
print(y1)
## For numeric arrays
x2 = matrix(rnorm(9), 3, 3)
y2 = relu(x2)
print(y2)
# }

Run the code above in your browser using DataLab