I'm dealing with weights in a RNNCell
.
I have the following code
var_names = []
for var in tf.trainable_variables():
var_names.append(var.name)
In another file called model.py
, I am printing the names of the trainable variables just appended to var_names
. However, I find that the "name" attribute of the trainable variables is not useful because not very descriptive.
Do the weights of an RNNcell
have names?
If that's useful, here's another possibly relevant piece of code:
cell_fn = tf.nn.rnn_cell.GRUCell
rnn_fw_1 = cell_fn(num_hidden_1, **additional_cell_args)
rnn_fw_1 = tf.nn.rnn_cell.DropoutWrapper(rnn_fw_1, input_keep_prob=keep_prob_1)
Try this:
variables_names = [v.name for v in tf.trainable_variables()]
values = sess.run(variables_names)
for k, v in zip(variables_names, values):
print "Variable: ", k
print "Shape: ", v.shape
print v
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With