Skip to contents

LSTM cell forward step (Geron Ch 13, morie.fn hmlstm)

Usage

morie_geron_lstm(x_t, h_prev, c_prev, weights)

Arguments

x_t

Input.

h_prev, c_prev

Previous short/long-term states.

weights

Named list with W_i,U_i,b_i,W_f,U_f,b_f,W_o,U_o,b_o,W_g,U_g,b_g.

Value

List with h_t, c_t, i_t, f_t, o_t, g_t, estimate, n, method.

Examples

Z <- list(W_i = matrix(0, 2, 2), U_i = matrix(0, 2, 2), b_i = c(0,
    0), W_f = matrix(0, 2, 2), U_f = matrix(0, 2, 2), b_f = c(0,
    0), W_o = matrix(0, 2, 2), U_o = matrix(0, 2, 2), b_o = c(0,
    0), W_g = matrix(0, 2, 2), U_g = matrix(0, 2, 2), b_g = c(0,
    0))
morie_geron_lstm(c(0, 0), c(0, 0), c(2, -2), Z)
#> $h_t
#> [1]  0.3807971 -0.3807971
#> 
#> $c_t
#> [1]  1 -1
#> 
#> $i_t
#> [1] 0.5 0.5
#> 
#> $f_t
#> [1] 0.5 0.5
#> 
#> $o_t
#> [1] 0.5 0.5
#> 
#> $g_t
#> [1] 0 0
#> 
#> $estimate
#> [1] 0.5385284
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "LSTM cell forward step"
#>