tf.get_collection获取训练变量等效用法

#    train_vars=tf.trainable_variables()
#    g_vars=[var for var in train_vars if var.name.startswith('generator')]
#    d_vars=[var for var in train_vars if var.name.startswith('discriminator')]
    g_vars=tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope='generator')
    d_vars=tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope='discriminator')

你可能感兴趣的:(我的Python学习,tensorflow学习)