Replies: 7 comments
-
>>> lissyx |
Beta Was this translation helpful? Give feedback.
-
>>> mattia.cerrato |
Beta Was this translation helpful? Give feedback.
-
>>> lissyx |
Beta Was this translation helpful? Give feedback.
-
>>> mattia.cerrato |
Beta Was this translation helpful? Give feedback.
-
>>> lissyx |
Beta Was this translation helpful? Give feedback.
-
>>> mattia.cerrato |
Beta Was this translation helpful? Give feedback.
-
>>> lissyx |
Beta Was this translation helpful? Give feedback.
-
>>> boborbt
[January 19, 2018, 4:57pm]
Dear all, slash
I am trying to inspect the hidden states of the recurrent part of the
network, but I cannot find a way to retrieve the relevant tensors. Is
there any way to do that?
A good starting point for me could be to retrieve the tensors
corresponding to the output states as returned by
tf.nn.bidirectional_dynamic_rnn(...)
as in:github.com
#### mozilla/DeepSpeech/blob/94ab93c42dfd369eb42cd7952692f04dc0deb40a/DeepSpeech.py slash #L449
<br/> lstm_bw_cell = tf.contrib.rnn.DropoutWrapper(lstm_bw_cell,<br/> input_keep_prob=1.0 - dropout[4],<br/> output_keep_prob=1.0 - dropout[4],<br/> seed=FLAGS.random_seed)<br/> <br/> # `layer_3` is now reshaped into `[n_steps, batch_size, 2*n_cell_dim]`,<br/> # as the LSTM BRNN expects its input to be of shape `[max_time, batch_size, input_size]`.<br/> layer_3 = tf.reshape(layer_3, [-1, batch_x_shape[0], n_hidden_3])<br/> <br/> # Now we feed `layer_3` into the LSTM BRNN cell and obtain the LSTM BRNN output.<br/> outputs, output_states = tf.nn.bidirectional_dynamic_rnn(cell_fw=lstm_fw_cell,<br/> cell_bw=lstm_bw_cell,<br/> inputs=layer_3,<br/> dtype=tf.float32,<br/> time_major=True,<br/> sequence_length=seq_length)<br/> <br/> # Reshape outputs from two tensors each of shape [n_steps, batch_size, n_cell_dim]<br/> # to a single tensor of shape [n_steps*batch_size, 2*n_cell_dim]<br/> outputs = tf.concat(outputs, 2)<br/> outputs = tf.reshape(outputs, [-1, 2*n_cell_dim])<br/>
My plan is to use the tensor name to retrieve the tensor value using
tf.Graph.get_tensor_by_name()
. I started by retrieving all availablenames using
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
names = [n.name for n in graph_def.node]
but to the best of my understanding this list does not contain the name
of the tensors I'm looking for. Am I on the right track?
Thanks in advance.
Roberto
[This is an archived TTS discussion thread from discourse.mozilla.org/t/retrieving-tensor-names-from-a-pre-trained-model]
Beta Was this translation helpful? Give feedback.
All reactions