Updating DeepSpeech for 0.10 API
This commit is contained in:
parent
78c93711f1
commit
8592093ffc
@ -101,8 +101,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import tensorflow as tf\n",
|
||||
"from tensorflow.python.ops.constant_op import constant\n",
|
||||
"from tensorflow.models.rnn import rnn, rnn_cell\n",
|
||||
"from tensorflow.python.framework.constant_op import constant\n",
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
@ -513,19 +512,19 @@
|
||||
" \n",
|
||||
" # Define lstm cells with tensorflow\n",
|
||||
" # Forward direction cell\n",
|
||||
" lstm_fw_cell = rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" lstm_fw_cell = tf.nn.rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" # Backward direction cell\n",
|
||||
" lstm_bw_cell = rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" lstm_bw_cell = tf.nn.rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" \n",
|
||||
" # Split data because rnn cell needs a list of inputs for the BRNN inner loop\n",
|
||||
" layer_3 = tf.split(0, n_steps, layer_3)\n",
|
||||
" \n",
|
||||
" # Get lstm cell output\n",
|
||||
" outputs = rnn.bidirectional_rnn(lstm_fw_cell,\n",
|
||||
" lstm_bw_cell,\n",
|
||||
" layer_3,\n",
|
||||
" initial_state_fw=_istate_fw,\n",
|
||||
" initial_state_bw=_istate_bw)\n",
|
||||
" outputs = tf.nn.bidirectional_rnn(lstm_fw_cell,\n",
|
||||
" lstm_bw_cell,\n",
|
||||
" layer_3,\n",
|
||||
" initial_state_fw=_istate_fw,\n",
|
||||
" initial_state_bw=_istate_bw)\n",
|
||||
" \n",
|
||||
" # Reshape outputs from a list of n_steps tensors each of shape [batch_size, 2*n_cell_dim]\n",
|
||||
" # to a single tensor of shape [n_steps*batch_size, 2*n_cell_dim]\n",
|
||||
@ -585,9 +584,9 @@
|
||||
"```python\n",
|
||||
" # Define lstm cells with tensorflow\n",
|
||||
" # Forward direction cell\n",
|
||||
" lstm_fw_cell = rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" lstm_fw_cell = tf.nn.rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" # Backward direction cell\n",
|
||||
" lstm_bw_cell = rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
" lstm_bw_cell = tf.nn.rnn_cell.BasicLSTMCell(n_cell_dim, forget_bias=1.0)\n",
|
||||
"```\n",
|
||||
"both of which have inputs of length `n_cell_dim` and bias `1.0` for the forget gate of the LSTM.\n",
|
||||
"\n",
|
||||
@ -601,11 +600,11 @@
|
||||
"The next line of `BiRNN`\n",
|
||||
"```python\n",
|
||||
" # Get lstm cell output\n",
|
||||
" outputs = rnn.bidirectional_rnn(lstm_fw_cell,\n",
|
||||
" lstm_bw_cell,\n",
|
||||
" layer_3,\n",
|
||||
" initial_state_fw=_istate_fw,\n",
|
||||
" initial_state_bw=_istate_bw)\n",
|
||||
" outputs = tf.nn.bidirectional_rnn(lstm_fw_cell,\n",
|
||||
" lstm_bw_cell,\n",
|
||||
" layer_3,\n",
|
||||
" initial_state_fw=_istate_fw,\n",
|
||||
" initial_state_bw=_istate_bw)\n",
|
||||
"```\n",
|
||||
"feeds `layer_3` to the LSTM BRNN cell and obtains the LSTM BRNN output.\n",
|
||||
"\n",
|
||||
@ -1224,7 +1223,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user