Stateful RNNs now support recurrent_dropout

main
Aurélien Geron 2019-04-21 15:55:39 +08:00
parent 33d1894dc1
commit 6f98bc5a04
1 changed files with 3 additions and 4 deletions

View File

@ -471,11 +471,10 @@
"source": [ "source": [
"model = keras.models.Sequential([\n", "model = keras.models.Sequential([\n",
" keras.layers.GRU(128, return_sequences=True, stateful=True,\n", " keras.layers.GRU(128, return_sequences=True, stateful=True,\n",
"# dropout=0.2, recurrent_dropout=0.2, # see TF issue #27829\n", " dropout=0.2, recurrent_dropout=0.2,\n",
" batch_input_shape=[batch_size, None, max_id]),\n", " batch_input_shape=[batch_size, None, max_id]),\n",
" keras.layers.GRU(128, return_sequences=True, stateful=True\n", " keras.layers.GRU(128, return_sequences=True, stateful=True,\n",
"# dropout=0.2, recurrent_dropout=0.2 # see TF issue #27829\n", " dropout=0.2, recurrent_dropout=0.2),\n",
" ),\n",
" keras.layers.TimeDistributed(keras.layers.Dense(max_id,\n", " keras.layers.TimeDistributed(keras.layers.Dense(max_id,\n",
" activation=\"softmax\"))\n", " activation=\"softmax\"))\n",
"])" "])"