我是tensorflow的首发 .

我知道我可以使用get_collection函数从变量所属的集合中获取变量 . 我知道变量可以嵌入到多个集合中 .

如下

import tensorflow as tf
# define variable
var1 = tf.constant(0.0,shape=[1,32,32,3])

# Add var to 'my_collections'
tf.add_to_collection('my_collections' ,value=phase_train)

print(tf.get_collection(tf.GraphKeys.LOCAL_VARIABLES))
# >>> [<tf.Variable 'Variable:0' shape=(1, 32, 32, 3) dtype=float32_ref>]
print(tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES))
# >>> [<tf.Variable 'Variable:0' shape=(1, 32, 32, 3) dtype=float32_ref>]

所以,这是我的问题 . 那么如何确定包含specfic变量的集合呢?