我正在使用 theano 扫描函数来实现 LSTM(长期短期记忆),但我得到了类似的错误
ValueError: Please provide None as outputs_info for any output that does not feed back into scan (i.e. it behaves like a map)
我像这样使用扫描
p_c = T.matrix()
p_hidden_inputs = T.matrix()
out, updates = scan(step_fprop,
sequences=model_inputs,
outputs_info= [p_c, p_hidden_inputs],
non_sequences=
[
Wxi, Whi, Wci, bi,
Wxf, Whf, Wcf, bf,
Wxc, Whc, bc,
Wxo, Who, Wco, bo
],
n_steps=n_steps,
)
step_fprop 定义如下:
def step_fprop(inputs, p_c, p_hidden_inputs,
Wxi, Whi, Wci, bi,
Wxf, Whf, Wcf, bf,
Wxc, Whc, bc,
Wxo, Who, Wco, bo
):
"""
Construct the forward propagation
:return:
:rtype:
"""
# input gate
ig = T.nnet.sigmoid(T.dot(inputs, Wxi) +
T.dot(p_hidden_inputs, Whi) +
T.dot(p_c, Wci) +
bi)
# forget gate
fg = T.nnet.sigmoid(T.dot(inputs, Wxf) +
T.dot(p_hidden_inputs, Whf) +
T.dot(p_c, Wcf) +
bf)
# cell
cc= fg * p_c + ig * T.tanh(T.dot(inputs, Wxc) +
T.dot(p_hidden_inputs, Whc ) +
bc)
#output gate
og = T.nnet.sigmoid(T.dot(inputs, Wxo) +
T.dot(p_hidden_inputs,Who) +
T.dot(p_c, Wco) +
bo)
#hidden state
hh = og * T.tanh(cc)
return hh
任何人都知道为什么我不断收到这种错误。