Access to the RNN Scale - Tensorflow

I am using tf.python.ops.rnn_cell.GRUCell

output, state = tf.nn.dynamic_rnn(
        GRUCell(HID_DIM),
        sequence,
        dtype=tf.float32,
        sequence_length=length(sequence)
)

How to get the weight of this GRUCell. I need to see them for debugging.

+6
source share
1 answer

The values โ€‹โ€‹of all variables in the current session can be printed using:

with tf.Session() as sess:
    variables_names =[v.name for v in tf.trainable_variables()]
    values = sess.run(variables_names)
    for k,v in zip(variables_names, values):
        print(k, v)
+2
source

Source: https://habr.com/ru/post/1016053/


All Articles