Learn R Programming

ggmlR (version 0.6.1)

ag_dropout: Create a Dropout layer

Description

In training mode applies inverted dropout (random Bernoulli mask, scale by 1/(1-rate) to preserve expected values). In eval mode is identity.

Usage

ag_dropout(rate)

Value

An ag_dropout environment

Arguments

rate

Drop probability in [0, 1)

Examples

Run this code
# \donttest{
drop <- ag_dropout(0.5)
x    <- ag_tensor(matrix(runif(8), 4, 2))
out  <- drop$forward(x)  # training mode by default
ag_eval(drop)
out2 <- drop$forward(x)  # identity
# }

Run the code above in your browser using DataLab