Skip to contents

GRU cell forward step (Geron Ch 13, morie.fn hmgru)

Usage

morie_geron_gru(x_t, h_prev, weights)

Arguments

x_t

Input vector.

h_prev

Previous hidden state.

weights

Named list with W_z,U_z,b_z,W_r,U_r,b_r,W_h,U_h,b_h.

Value

List with h_t, z_t, r_t, h_tilde, estimate, n, method.

Examples

W <- list(W_z = matrix(0, 2, 2), U_z = matrix(0, 2, 2), b_z = c(0,
    0), W_r = matrix(0, 2, 2), U_r = matrix(0, 2, 2), b_r = c(0,
    0), W_h = matrix(0, 2, 2), U_h = matrix(0, 2, 2), b_h = c(0,
    0))
morie_geron_gru(c(0, 0), c(4, -2), W)
#> $h_t
#> [1]  2 -1
#> 
#> $z_t
#> [1] 0.5 0.5
#> 
#> $r_t
#> [1] 0.5 0.5
#> 
#> $h_tilde
#> [1] 0 0
#> 
#> $estimate
#> [1] 2.236068
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "GRU cell forward step"
#>