How do you use TensorFlow Graphkeys to get all weights?

Viewed 2411

Tensorflow defines a preset of collections as can be seen here: https://www.tensorflow.org/versions/r0.12/api_docs/python/framework/graph_collections

I am currently using tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES) to get all the variables [*which are named; if they are not then they are not displayed, even if they exist].

Similarly, I expected tf.get_collection(tf.GraphKeys.WEIGHTS) to output a list of weights, but rather it is an empty array. This also holds true for GraphKeys.BIASES and .ACTIVATIONS.

What's going on here?

In my opinion, there seems to be two possibilities here. First, these are are actually never automatically defined, and are just recommended collection names. Second, my network is very broken, but that doesn't seem to be the case.

Anyone have experience with this?

2 Answers
Related