I'm trying to get all the variables in a variable scope, as is explained here. However, the line tf.get_collection(tf.GraphKeys.VARIABLES, scope='my_scope')
is returning an empty list even though there are variables in that scope.
Here's some example code:
import tensorflow as tf
with tf.variable_scope('my_scope'):
a = tf.Variable(0)
print tf.get_collection(tf.GraphKeys.VARIABLES, scope='my_scope')
which prints []
.
How can I get the variables declared in 'my_scope'
?