Image Caption(三) 一些补充

构建LSTM模型:

#定义一个LSTM_cell
lstm_cell = rnn.BasicLSTMCell(
     hidden_size, 
     forget_bias = 1.0, 
     state_is_tuple = True
 )

lstm_cell = rnn.DropoutWrapper(   
     cell = lstm_cell, 
     input_keep_prob = 1.0,
     output_keep_prob = keep_prob
 )

LSTM在传播的过程中会保存中间状态,state_is_tuple会返回一个元组

猜你喜欢

转载自blog.csdn.net/weixin_38440272/article/details/84432459