The documentation says it's a 1 d tensor, however, I have failed to figure out how to access the list.
I would prefer the actual variables rather than names as I would like to initialize them via tf.variables_initializer()
The documentation says it's a 1 d tensor, however, I have failed to figure out how to access the list.
I would prefer the actual variables rather than names as I would like to initialize them via tf.variables_initializer()
tf.report_uninitialized_variables()
gives you a tensor with the names of the variables. So it will be way more ugly (in my opinion) than my solution here.
You will need to find all the variables corresponding to names you got from report_uninitialized_variables
and they use them in your tf.variables_initializer()
. Something like this:
tf.variables_initializer(
[v for v in tf.global_variables() if v.name.split(':')[0] in set(sess.run(tf.report_uninitialized_variables()))
])