Keras:如何获得GRU的initial_state

时间:2017-10-22 05:53:01

标签: deep-learning keras lstm rnn

我已经使用Keras定义了GRU,如何获取GRU的initial_state(h_0)?任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

图层中有一个州名单

gru_layer_number = 2 # order of definition
model.layers[gru_layer_number].states

您可以使用initial_state参数定义初始状态documentation says

您还可以检查get_initial_state()功能(尚未测试)