LSTM中模型的输出为ht,中间状态为ct
i
t
=
σ
(
W
i
i
x
t
+
b
i
i
+
W
h
i
h
(
t
−
1
)
+
b
h
i
)
f
t
=
σ
(
W
i
f
x
t
+
b
i
f
+
W
h
f
h
(
t
−
1
)
+
b
h
f
)
g
t
=
tanh
(
W
i
g
x
t
+
b
i
g
+
W
h
g
h
(
t
−
1
)
+
b
h
g
)
o
t
=
σ
(
W
i
o
x
t
+
b
i
o
+
W
h
o
h
(
t
−
1
)
+
b
h
o
)
c
t
=
f
t
∗
c
(
t
−
1
)
+
i
t
∗
g
t
h
t
=
o
t
∗
tanh
(
c
t
)
\begin{array}{ll} \\ i_t = \sigma(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\ f_t = \sigma(W_{if} x_t + b_{if} + W_{hf} h_{(t-1)} + b_{hf}) \\ g_t = \tanh(W_{ig} x_t + b_{ig} + W_{hg} h_{(t-1)} + b_{hg}) \\ o_t = \sigma(W_{io} x_t + b_{io} + W_{ho} h_{(t-1)} + b_{ho}) \\ c_t = f_t * c_{(t-1)} + i_t * g_t \\ h_t = o_t * \tanh(c_t) \\ \end{array}
it=σ(Wiixt+bii+Whih(t−1)+bhi)ft=σ(Wifxt+bif+Whfh(t−1)+bhf)gt=tanh(Wigxt+big+Whgh(t−1)+bhg)ot=σ(Wioxt+bio+Whoh(t−1)+bho)ct=ft∗c(t−1)+it∗gtht=ot∗tanh(ct)
由
h
t
=
o
t
∗
t
a
n
h
(
c
t
)
h_t=o_t*tanh(c_t)
ht=ot∗tanh(ct)可知,ht为LSTM模型的输出,ct为中间状态。