1. 程式人生 > >Image Caption(三) 一些補充

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會返回一個元組